Re: [PHP] A question...

2005-11-09 Thread Richard Lynch
On Tue, November 8, 2005 3:48 pm, Tony Di Croce wrote:
 Oops!

 I meant SESSION[]! Thanks guys...

 So then the question becomes, is storing stuff in SESSION[] insecure?
 Is
 their any point to encrypting what a store in SESSION[]?

On a shared server, this would be a really Good Idea (tm) if other
users co-hosted on that server can read your session files.

On a dedicated server, it could be considered a Defense in Depth
technique, so that if somebody manages to get logged in, they can't as
quickly and easily start snagging PHP session data...  If that's what
they were after in the first place.

You have to weigh benefits and risks of what you are storing as well.
If all you store about me is that I want bluesilver for my Forum
skin, well, whoop-de-doo if somebody else reads that.

If you're storing my PASSWORD in there, and I'm probably using the
same damn stupid password for all these thousand forum logins, then,
yeah, maybe you oughta protect that pretty hard.

PS
Still want to be careful about dumping out $_SESSION in all its glory.

-- 
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] $pieces = explode(,, $_POST[fieldtype1]);

2005-11-09 Thread Richard Lynch
On Mon, November 7, 2005 11:00 pm, John Taylor-Johnston wrote:
 $pieces = explode(,, $_POST[fieldtype1]);

 What is a way to echo each pieces[x] separately so I can echo them
 like
 this:

 while(x=0 to xMax)
 {
 $sql .= `.$pieces[x].` \r\n;
 }

foreach ($pieces as $piece){
  $sql .= '$piece'\r\n;
}

Though you probably don't really want the \r\n in there...

But you may find this even easier:

$pieces_sql = implode(', ', $pieces);
$sql .= '$pieces_sql';

In between explode($_POST) and whatever you do, you REALLY ought to
call mysql_real_escape_string on each $pieces element.

-- 
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



[PHP] Re: security code

2005-11-09 Thread Rosty Kerei
Yep! It's called captcha. There is a PEAR package Text/CAPTCHA, and also you 
can find some other classes at phpclasses.org
Good luck!

Sincerely,
Rosty Kerei [EMAIL PROTECTED]

Clive [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi
 does any one have a class/function to generate those security code images.

 Yhe ones that you see on website that you must enter to submit a form

 thanks

 clive 

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



Re: [PHP] PHP Search Engine

2005-11-09 Thread Petr Smith

Richard Lynch wrote:

On Tue, November 8, 2005 11:20 pm, Leonard Burton wrote:


Has anyone on here created a search engine in PHP?



Sure, of sorts, now and again, here and there, to some degree.




I am reasonably certain that if you Googled for:
PHP web spider framework
you would find several packages that would have at least 99% of what
you need...  Because these simply have to exist out there.



From you description it seems like writing search engine (full text) is 
simple task for three or four nights. It's not true.


Writing quality full text search engine is very complex task and you can 
stuck at lots of problems. If you don't understand the theory of text 
searching, you can finish it somehow, but it will not search the way 
people are used to. The results will be wrong.


You think there have to be something written in PHP. There is not. Lots 
of dead experiments - yes. Something good, working and in active 
developement - no. There is even not much open source search engines 
written in other languages. You just cannot stick to PHP - but it 
doesn't matter in which language is the spider. You need only some 
interface to the search part.


Here's my list:

mysql fulltext - toy for children
phpdig - lots of little problems here and there, unusable
htdig - dead, buggy
swish-e - dead?
swish++ - one man show?
aspseek - dead
mnogosearch - try it, it's not google, but usable, php interface
lucene - top quality, best query syntax
egothor - people says it's usable

did I forgot something good?

Petr

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



Re: [PHP] Re: PHP 4.4.1 on Apache 2.0.x issue

2005-11-09 Thread Max Belushkin
 Maybe the following [1] thread on the FreeBSD ports lists does help you.
 I (and the other sysops/users of this machine) are waiting for a patch
 for this problem

 You're not the only one :-)
 [1]
 http://lists.freebsd.org/pipermail/freebsd-ports/2005-November/027038.html

Oh, thanks a lot! I'll be keeping an eye on the thread - I have mod_rewrite 
employed... well, everywhere, so I'm guessing that's what the culprit was. 
Will be waiting for patch news before trying to update to 4.4.1 again! :)

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



RE: [PHP] PHP Search Engine

2005-11-09 Thread Arno Kuhl
-Original Message-
From: Petr Smith [mailto:[EMAIL PROTECTED]
Sent: 09 November 2005 11:27
To: php-general@lists.php.net
Subject: Re: [PHP] PHP Search Engine


Richard Lynch wrote:
 On Tue, November 8, 2005 11:20 pm, Leonard Burton wrote:

Has anyone on here created a search engine in PHP?


 Sure, of sorts, now and again, here and there, to some degree.


 I am reasonably certain that if you Googled for:
 PHP web spider framework
 you would find several packages that would have at least 99% of what
 you need...  Because these simply have to exist out there.


 From you description it seems like writing search engine (full text) is
simple task for three or four nights. It's not true.

Writing quality full text search engine is very complex task and you can
stuck at lots of problems. If you don't understand the theory of text
searching, you can finish it somehow, but it will not search the way
people are used to. The results will be wrong.

You think there have to be something written in PHP. There is not. Lots
of dead experiments - yes. Something good, working and in active
developement - no. There is even not much open source search engines
written in other languages. You just cannot stick to PHP - but it
doesn't matter in which language is the spider. You need only some
interface to the search part.

Here's my list:

mysql fulltext - toy for children
phpdig - lots of little problems here and there, unusable
htdig - dead, buggy
swish-e - dead?
swish++ - one man show?
aspseek - dead
mnogosearch - try it, it's not google, but usable, php interface
lucene - top quality, best query syntax
egothor - people says it's usable

did I forgot something good?

Petr

--

It sounds like this is specifically for html pages, or am I assuming wrong?
Do any of these or other search engines index html content held in a MySQL
database?

Arno

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



Re: [PHP] PHP Search Engine

2005-11-09 Thread Petr Smith

It sounds like this is specifically for html pages, or am I assuming wrong?
Do any of these or other search engines index html content held in a MySQL
database?

Arno


It depends.. Some products are based around web spider (mnogosearch), 
some are only engines without spider part (lucene).


There are ways to add web spider to engine (nutch for lucene) or use 
only engine part of web spider (you can always generate local content 
[file structure] from database, it's not very clever but it works).


So the answer is yes, you can always index MySQL content somehow.

Petr

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



Re: [PHP] PEAR on PHP 5+?

2005-11-09 Thread M

Minuk Choi wrote:

I can't seem to get pear to work correctly.

if I type

[/]# pear install DB

I get the usage printed out back(no error message, no action)

and if I go to the PHP-5.0.4/lib/php directory, I get
[PHP-5.0.4/lib/php]# pear install DB

br /
bFatal error/b: Call to undefined function: getoptions() in 
b/usr/bin/pear/b on lineb34/bbr /


I tried with PHP-5.0.3 and PHP-5.0.2 with the same result.  With some 
google-assisted digging, I found that PEAR/Command.php doesn't have a 
getOptions function defined... but instead of me trying to overwrite a 
file or two, I'd like to ask this question


Is PEAR broken with PHP5?

I mean, I tried re-installing it... (only PHP-5.0.2 - PHP-5.0.4) and 
pear or pearcmd.php doesn't work.  It worked fine for PHP 4, so I'm a 
little surprised.  Any insight?


do you have only php5 version installed? If you execute
$ php -v
what version do you get?

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



[PHP] Re: comment more than a question

2005-11-09 Thread James Benson
It takes some getting used to I admit but PHP errors turned up full is 
far than enough to fix any script, in my experience






matt VanDeWalle wrote:
I don't really have a question, I just have noticed in working with php 
for about a year off and on, so you could probably say i'm a bit new 
still, what an error says it is, or what line it is on, is hardly ever 
the case, e.g, several different times until i figured out what this 
meant, i would get the unexpected $ on line two lines past the end of 
the script error, I've figured out that actually means you are missing 
a closing } or a few
also tonight, I was working on a script, I figured this out about an 
hour later but i was getting an error about unexpected '\' ascii 92 in 
line#, something to that effect; I infact  did not have a stray \, but 
the script i was calling in this particular function apparently didn't 
sit well with the code, so, i just read the code into the function 
instead of include'ing the script and everything is happy again
so I guess just letting new or somewhat new, users know not to take the 
php's errors for what they say always, sometimes it works that way, not 
much, or, in my experience anyway


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



[PHP] PHP 5 OO performance exceptions

2005-11-09 Thread cron
Hello, 

 

Currently I'm make some utilities classes and I took the idea from java to make 
some wrappers class like String, Integer and so on. This allows me to use the 
type hint for basic types in php.  Anyone have a clue if replacing the all in 
one type in php for objects types will degrade the performance?

 

Also for every controller class that I'm making I'm also making exceptions 
class of every error that it can generate.  Same questions: It will degrade 
performance to throw an exception instead of lest say a pear error or return 
false?

 

Just for know, I'm doing this because I believe that it will eliminate some o 
problems o development and will eliminate some basic validations.





Any tips appreciate



Angelo





Re: [PHP] Re: Session's across Domains...

2005-11-09 Thread Ben Ramsey

On 11/8/05 11:52 PM, Chris Shiflett wrote:
When I've provided this feature in the past, I've always taken advantage 
of launch and landing pages - e.g., users could only get to the other 
domain and still be logged in if they clicked a link from my 
application, and those links all go through a launch page. This page 
takes care of generating whatever data I plan to send to the remote 
domain (including the URL that the user wants to visit) and redirecting 
the user to the landing page at that domain. With servers synchronized 
with ntpd, this lets you close the window of opportunity down to just a 
few seconds, strengthening the technique.


I spoke to Chris a little further about this last night (so I'm 
crediting him with this), and I've noticed he hasn't responded, so I'm 
doing so.


He said that, since the domains are on the same machine, it's relatively 
easy for them to share the same session id (something I wasn't 
disputing), and he offered a solution to mitigate exposure of the 
session id: a temporary token.


Instead of passing the session id, create a randomly generated session 
token that is only valid for, say, 2 to 5 minutes. On the server, you 
can specify to which session the token corresponds, but you never reveal 
this to the client. You only reveal the token. Since it's only valid for 
a very small window of time, then, even if it is sniffed or appended to 
a URL (like in the linking examples I was giving), it won't allow others 
to use it to log in because it will have already expired.


This alleviates the exposure issues I was discussing.

Hope this helps.

--
Ben Ramsey
http://benramsey.com/

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



RE: [PHP] to the freelancers!!

2005-11-09 Thread bruce
richard...

you miss a key nuance/point to the msg. her idea/thought was twofold. 1)
whether companies would have ideas/projects that they would be interested in
partially funding, and 2) if there would be a 'talented' pool of developers
who would be interested in working on the initial apps.

there are a lot of ideas within companies that don't ever make it to full
blown products. the basic idea would be to setup a structure and to find
companies that have these projects. the project could be a possible add on
to round out the biz offerings, it might be a test for a new
direction/product, it might be a project that you fund for competitive
reasons, etc...

the intent would not be to secure complete funding to fully
create/market/sell the product/project code (that's what the vc is for!!)
rather, the goal of the structure would be to 'jump start'/test apps in a
relatively fast/efficient manner.

the structure would be set up to get the projects, manage the projects,
distribute the initial funding, based on the project goals...

the question was whether there are talented developers who'd want to
participate in this kind of function/structure.

there are already a great deal of conusulting companies who look to
businesses for consulting/development/design work. this kind of model would
simply be an offshoot of that kind of approach.

-bruce




-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 08, 2005 7:29 PM
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Subject: Re: [PHP] to the freelancers!!


On Thu, November 3, 2005 7:15 pm, bruce wrote:
 Just a quick question. Had a conversation with a person who works for
 a
 non-profit, and she was describing some of her dealings with obtaining
 grants for the development of 'open source' apps.Got me to thinking.
 If a
 company sponsored the initial development of an 'open source' kind of
 app
 (the exact licensing would need to be fleshed out) what do yout think
 would
 be the response of people to work on the apps..

 I started to wnoder if there would be a pool of talented people who
 would be
 interested in working on projects that are initially funded. The
 funding
 would go to pay the resources, set up the project, do initial grass
 roots
 marketing, etc... The idea would be to focus in on the
 projects/technologies/apps that a given business would agree to
 initially
 support/fund.

 Thoughts/comments/etc...

 -bruce
 [EMAIL PROTECTED]

 ps. I'm not talking about a freshmeat.net/sourceforge kind of
 environment.
 The obvious goal of this kind of process would be to turn small
 applications/projects into profitable applications. My curiousity is
 whether
 you could then create applications/services that could be built along
 the
 same model as nagios/mysql/etc.. where you have a free/open version,
 as well
 as a fee based application/service.

I think there was a Penguin MasterCard/Visa company set up for
something very much like this...  Though that was to just fund the
projects, not to build companies around them.  LinuxCard, was it?

Also, in a loose sort of way, your description matches something
commonly referred to as the dot boom...  and the dot bomb for that
mattter. :-)

There were a ZILLION start-ups with cool ideas, no friggin' idea
whatsoever of how to make revenue from it, and zillions of dollars
blown on pinball machines and beanbag chairs for the developers.

Ah, the glory days. :-)

I think the trick would be to find the right project, sponsors, and
people, rather than to just express the general idea as you have
above...

Sort of like this post:
http://www.oreillynet.com/pub/wlg/7614

--
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

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



[PHP] Re: security code

2005-11-09 Thread Gustavo Narea

Hello, Clive.

Depending on the target of your website, you shall need to keep in mind 
the (in)accessibility of this kind of tests: 
http://www.w3.org/TR/2003/WD-turingtest-20031105/


By the way, AFAIK they are also known as turing numbers.

Regards.

Clive wrote:

Hi
does any one have a class/function to generate those security code images.

Yhe ones that you see on website that you must enter to submit a form

thanks

clive


--
Best regards,

Gustavo Narea.
PHP Documentation - Spanish Translation Team.
Valencia, Venezuela.

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



Re: [PHP] Using the echo tag...

2005-11-09 Thread Paul Williams

?php

print EOF

HTML
$_SERVER['PHP_SELF']
/HTML
EOF;

?

Here's the coding and the error for it was this:


 Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
 expecting
 T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files\Abyss Web
 Server\htdocs\document1.php on line 6
 



Thank you.
Sincerely,


Paul Lee Williams III






From: Richard Lynch [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: Paul Williams [EMAIL PROTECTED]
CC: php-general@lists.php.net
Subject: Re: [PHP] Using the echo tag...
Date: Tue, 8 Nov 2005 19:25:12 -0600 (CST)
MIME-Version: 1.0
Received: from o2.hostbaby.com ([67.139.134.202]) by mc5-f37.hotmail.com 
with Microsoft SMTPSVC(6.0.3790.211); Tue, 8 Nov 2005 17:25:08 -0800

Received: (qmail 79084 invoked by uid 98); 9 Nov 2005 01:25:13 -
Received: from 127.0.0.1 by o2.hostbaby.com (envelope-from [EMAIL PROTECTED], 
uid 1013) with qmail-scanner-1.25  (clamdscan: 0.70-rc.   
Clear:RC:1(127.0.0.1):.  Processed in 0.157818 secs); 09 Nov 2005 01:25:13 
-
Received: from unknown (HELO l-i-e.com) (127.0.0.1)  by localhost with 
SMTP; 9 Nov 2005 01:25:12 -
Received: from 67.108.68.36(SquirrelMail authenticated user 
[EMAIL PROTECTED])by www.l-i-e.com with HTTP;Tue, 8 Nov 2005 
19:25:12 -0600 (CST)

X-Message-Info: JGTYoYF78jEHjJx36Oi8+Z3TmmkSEdPtfpLB7P/ybN8=
X-Qmail-Scanner-Mail-From: [EMAIL PROTECTED] via o2.hostbaby.com
X-Qmail-Scanner: 1.25 (Clear:RC:1(127.0.0.1):. Processed in 0.157818 secs)
References: [EMAIL PROTECTED]
[EMAIL PROTECTED]

User-Agent: Hostbaby Webmail
Return-Path: [EMAIL PROTECTED]
X-OriginalArrivalTime: 09 Nov 2005 01:25:09.0224 (UTC) 
FILETIME=[6C5A3680:01C5E4CC]


On Tue, November 8, 2005 5:32 pm, Paul Williams wrote:
 Nope sorry. It says this error 
 Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
 expecting
 T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files\Abyss Web
 Server\htdocs\document1.php on line 6
 

Show us EXACTLY what you have in lines 1 through 6.

Not just sorta.

Copy-n-paste it.

Or put it up on the web as TEXT output.

Odds are pretty good your real mistake is in line 5 or even before that.

--
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] Using the echo tag...

2005-11-09 Thread Ben Ramsey

On 11/9/05 9:45 AM, Paul Williams wrote:

?php

print EOF

HTML
$_SERVER['PHP_SELF']
/HTML
EOF;

?


Try it with curly braces:

?php

print EOF

HTML
{$_SERVER['PHP_SELF']}
/HTML
EOF;

?

--
Ben Ramsey
http://benramsey.com/

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



Re: [PHP] Using the echo tag...

2005-11-09 Thread Paul Williams
Alright cool that one worked. Do I have to include the curly braces in all 
calls to variables or just the superglobals?




Thank you.
Sincerely,


Paul Lee Williams III






From: Ben Ramsey [EMAIL PROTECTED]
To: php-general@lists.php.net,Paul Williams [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: Re: [PHP] Using the echo tag...
Date: Wed, 09 Nov 2005 09:48:52 -0500
MIME-Version: 1.0
Received: from lists.php.net ([216.92.131.4]) by mc10-f41.hotmail.com with 
Microsoft SMTPSVC(6.0.3790.211); Wed, 9 Nov 2005 06:48:57 -0800
Received: from ([69.164.218.60:21029] helo=localhost.localdomain)by 
pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTPid 16/ED-28724-75C02734 
for [EMAIL PROTECTED]; Wed, 09 Nov 2005 09:48:55 -0500

X-Message-Info: JGTYoYF78jEHjJx36Oi8+Z3TmmkSEdPtfpLB7P/ybN8=
Return-Path: [EMAIL PROTECTED]
X-Host-Fingerprint: 69.164.218.60 
eycb01-00-cntnga-69-164-218-60.atlaga.adelphia.net  User-Agent: Mozilla 
Thunderbird 1.0.6 (Macintosh/20050716)

X-Accept-Language: en-us, en
References: [EMAIL PROTECTED] 
[EMAIL PROTECTED]

X-Posted-By: 69.164.218.60
X-OriginalArrivalTime: 09 Nov 2005 14:48:57.0698 (UTC) 
FILETIME=[B6C35420:01C5E53C]


On 11/9/05 9:45 AM, Paul Williams wrote:

?php

print EOF

HTML
$_SERVER['PHP_SELF']
/HTML
EOF;

?


Try it with curly braces:

?php

print EOF

HTML
{$_SERVER['PHP_SELF']}
/HTML
EOF;

?

--
Ben Ramsey
http://benramsey.com/


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



[PHP] R: [PHP] Using the echo tag...

2005-11-09 Thread Alan D'angelo - Media Beat Information Technology

Use:

 
?php

print EOF

HTML
{$_SERVER['PHP_SELF']}
/HTML
EOF;

? 

Best Regards,
Alan


-Messaggio originale-
Da: Paul Williams [mailto:[EMAIL PROTECTED] 
Inviato: mercoledì 9 novembre 2005 15.45
A: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Oggetto: Re: [PHP] Using the echo tag...

?php

print EOF

HTML
$_SERVER['PHP_SELF']
/HTML
EOF;

?

Here's the coding and the error for it was this:

  Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, 
  expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program 
  Files\Abyss Web Server\htdocs\document1.php on line 6 


Thank you.
Sincerely,


Paul Lee Williams III





From: Richard Lynch [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: Paul Williams [EMAIL PROTECTED]
CC: php-general@lists.php.net
Subject: Re: [PHP] Using the echo tag...
Date: Tue, 8 Nov 2005 19:25:12 -0600 (CST)
MIME-Version: 1.0
Received: from o2.hostbaby.com ([67.139.134.202]) by 
mc5-f37.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 8 Nov 
2005 17:25:08 -0800
Received: (qmail 79084 invoked by uid 98); 9 Nov 2005 01:25:13 -
Received: from 127.0.0.1 by o2.hostbaby.com (envelope-from [EMAIL 
PROTECTED], 
uid 1013) with qmail-scanner-1.25  (clamdscan: 0.70-rc.   
Clear:RC:1(127.0.0.1):.  Processed in 0.157818 secs); 09 Nov 2005 
01:25:13 -
Received: from unknown (HELO l-i-e.com) (127.0.0.1)  by localhost with 
SMTP; 9 Nov 2005 01:25:12 -
Received: from 67.108.68.36(SquirrelMail authenticated user 
[EMAIL PROTECTED])by www.l-i-e.com with HTTP;Tue, 8 Nov 2005 
19:25:12 -0600 (CST)
X-Message-Info: JGTYoYF78jEHjJx36Oi8+Z3TmmkSEdPtfpLB7P/ybN8=
X-Qmail-Scanner-Mail-From: [EMAIL PROTECTED] via o2.hostbaby.com
X-Qmail-Scanner: 1.25 (Clear:RC:1(127.0.0.1):. Processed in 0.157818 secs)
References: [EMAIL PROTECTED]
[EMAIL PROTECTED]
User-Agent: Hostbaby Webmail
Return-Path: [EMAIL PROTECTED]
X-OriginalArrivalTime: 09 Nov 2005 01:25:09.0224 (UTC) 
FILETIME=[6C5A3680:01C5E4CC]

On Tue, November 8, 2005 5:32 pm, Paul Williams wrote:
  Nope sorry. It says this error 
  Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, 
  expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program 
  Files\Abyss Web Server\htdocs\document1.php on line 6 

Show us EXACTLY what you have in lines 1 through 6.

Not just sorta.

Copy-n-paste it.

Or put it up on the web as TEXT output.

Odds are pretty good your real mistake is in line 5 or even before that.

--
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

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



Re: [PHP] Using the echo tag...

2005-11-09 Thread Ben Ramsey

On 11/9/05 9:51 AM, Paul Williams wrote:
Alright cool that one worked. Do I have to include the curly braces in 
all calls to variables or just the superglobals?


It's not a superglobal issue; it's an array issue -- or, rather, it's an 
issue with using quotation marks. You could have also done it this way:


?php

print EOF

HTML
$_SERVER[PHP_SELF]
/HTML
EOF;

?

Personally, I put curly braces around all interpolated variables because 
it makes it easier for me to read and see the variables, but this is 
really up to user preference.


--
Ben Ramsey
http://benramsey.com/

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



Re: [PHP] PEAR on PHP 5+?

2005-11-09 Thread Minuk Choi
Thanks!  It turns out there was an rpm installed php-4.2.3 which was 
clobbering with my PHP-5.0.5 installation.


I removed it with

apt-get remove php

and reinstalled PHP-5.0.5 and pear works fine!

Thanks again!

-Minuk

M wrote:


Minuk Choi wrote:


I can't seem to get pear to work correctly.

if I type

[/]# pear install DB

I get the usage printed out back(no error message, no action)

and if I go to the PHP-5.0.4/lib/php directory, I get
[PHP-5.0.4/lib/php]# pear install DB

br /
bFatal error/b: Call to undefined function: getoptions() in 
b/usr/bin/pear/b on lineb34/bbr /


I tried with PHP-5.0.3 and PHP-5.0.2 with the same result.  With some 
google-assisted digging, I found that PEAR/Command.php doesn't have a 
getOptions function defined... but instead of me trying to overwrite 
a file or two, I'd like to ask this question


Is PEAR broken with PHP5?

I mean, I tried re-installing it... (only PHP-5.0.2 - PHP-5.0.4) and 
pear or pearcmd.php doesn't work.  It worked fine for PHP 4, so I'm a 
little surprised.  Any insight?



do you have only php5 version installed? If you execute
$ php -v
what version do you get?



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



Re: [PHP] Using the echo tag...

2005-11-09 Thread Ben Ramsey

On 11/9/05 10:03 AM, Paul Williams wrote:
So would it be acceptable if I used curly braces on all variables 
(whether superglobals or not) in a here document?


Yes.

--
Ben Ramsey
http://benramsey.com/

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



Re: [PHP] Re: Session's across Domains...

2005-11-09 Thread Ben Ramsey
I'm posting this back to the list to keep the conversation there. I hope 
you don't mind. My comments are at the bottom . . .



On 11/9/05 10:10 AM, Tony Di Croce wrote:
The reason I even wanted to do this had more to do with sharing some 
data between two sites, and less with really maintaining a login.


It occured to me that I need not share sessions at all. Instead, all 
of the data B needs could simply be encrypted by A and sent in a post field.


Now, this does bring up the problem that someone could sniff this 
packet, capture this encrypted packet, and use it to authenticate 
themselves on B. They never had to decrypt it, just capture from A, and 
send to B at their leisure...


Let me give some background here on exactly what I'm doing, as it may 
clear things up a bit.


B is a secure page, with a CC info form that when submitted will process 
their card, charging the amount of money passed in the encrypted packet, 
and if the charge succeeds, redirecting back to A. A would probably need 
to send an order number to B, and B could pass that back to A upon 
success or failure.


All of this is to get around the Apache limitation of allowing only one 
virtual host to use SSL.


Anyhow, B could keep track of all of the order numbers it was sent by A, 
and if it was re-sent a duplicate could simply deny the whole 
transaction. Thus, if someone sniffed my encrypted data burrito, and 
attempted to re-use it to gain access to B, they would fail, since B 
will only allow that burrito ONCE. Perhaps these order numbers could be 
GUID's.


How does this sound?


I think someone else here could probably offer some better advice, but 
here's what I would do.


I would definitely use SSL when dealing with CC data, but I don't think 
there's an Apache limitation that restricts the use of SSL to one host. 
There is a limitation that restricts the use of an SSL certificate to 
one host, so, if you had two certificates, both hosts could use SSL 
sockets, but I don't think that's what you need here. (You could still 
use the same certificate across multiple hosts, but then the user is 
going to be prompted in the browser whether or no to allow the 
certificate to be used, and this is generally not a good idea.)


What you need to do is ensure that your FORM action on domain A (the 
unsecured domain) is POSTing to https://domain-b.org. Note the usage of 
HTTPS. This will ensure that the data is sent along the secure channel 
and not in clear text. You don't need to perform any encryption, since 
SSL takes care of that for you.


Then, B could simply redirect back to A after processing the order and 
pass the order number through the query string (since it's probably not 
very sensitive).


Does this answer your question?

And, yeah, denying used order numbers would be a good idea.

--
Ben Ramsey
http://benramsey.com/

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



[PHP] java .vs php

2005-11-09 Thread bruce
hi...

php appears to be fine/good for prototyping. my question; does anybody have
testing experience regarding scalability of php .vs java. ie, can php scale
to handle 1000s of simultaneous connections/users, as well as deal with the
various security issues...

articles dealing with actual live test data would be helpful. i'd also be
interested in hearing from your experience if you've actually had to look
into this issue.

haven't really seen a lot of hard data on this via google.. lots of mine is
better than yours.. but i'm trying to really get a feel as to whether php
can really drive serious commercial sites...

thanks

-bruce
[EMAIL PROTECTED]

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



Re: [PHP] Re: comment more than a question

2005-11-09 Thread Jake Gardner
Yeah I never really look at what the error message actually says, it
usually turns out to be unhelpful because of those line numbers. I
just look, for example, to see if it says the error happened past the
last line of the script, and I know im missing a } somewhere. The
errors PHP returns are more about reading inbetween the lines than
reading the actual error lines.

On 11/9/05, James Benson [EMAIL PROTECTED] wrote:
 It takes some getting used to I admit but PHP errors turned up full is
 far than enough to fix any script, in my experience





 matt VanDeWalle wrote:
  I don't really have a question, I just have noticed in working with php
  for about a year off and on, so you could probably say i'm a bit new
  still, what an error says it is, or what line it is on, is hardly ever
  the case, e.g, several different times until i figured out what this
  meant, i would get the unexpected $ on line two lines past the end of
  the script error, I've figured out that actually means you are missing
  a closing } or a few
  also tonight, I was working on a script, I figured this out about an
  hour later but i was getting an error about unexpected '\' ascii 92 in
  line#, something to that effect; I infact  did not have a stray \, but
  the script i was calling in this particular function apparently didn't
  sit well with the code, so, i just read the code into the function
  instead of include'ing the script and everything is happy again
  so I guess just letting new or somewhat new, users know not to take the
  php's errors for what they say always, sometimes it works that way, not
  much, or, in my experience anyway

 --
 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] java .vs php

2005-11-09 Thread Richard Heyes

bruce wrote:

hi...

php appears to be fine/good for prototyping. my question; does anybody have
testing experience regarding scalability of php .vs java. ie, can php scale
to handle 1000s of simultaneous connections/users, as well as deal with the
various security issues...

articles dealing with actual live test data would be helpful. i'd also be
interested in hearing from your experience if you've actually had to look
into this issue.

haven't really seen a lot of hard data on this via google.. lots of mine is
better than yours.. but i'm trying to really get a feel as to whether php
can really drive serious commercial sites...


Put simply, it's down to the quality of the programmer. Good programmer 
= good code; scalable and performant. Bad programmer = bad code. It 
doesn't get any simpler than that really.


--
Richard Heyes
http://www.phpguru.org

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



Re: [PHP] java .vs php

2005-11-09 Thread Chris Shiflett

bruce wrote:

i'm trying to really get a feel as to whether php can really drive
serious commercial sites.


Yahoo gets 3.4 billion page views per day. That serious enough for you?

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

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



Re: [PHP] Type of form element

2005-11-09 Thread Jake Gardner
Uh isset will work in this particular instance because $_POST is
an array whose values are of one type and one type only: STRINGS.

Yes, it is true that:
$myArray['a'] = NULL;
isSet($myArray['a']); //Will return FALSE.

However, because $_POST contains STRINGS AND STRINGS ONLY, isSet works:

$myArray['a'] = '';
$myArray['b'] = NULL;
isSet($myArray['a']); //Will return TRUE
isSet($myArray['b']); //Will return TRUE
isSet($myArray['c']); //Will return FALSE

$_POST will *NOT* contain a value of NULL type. It's not possible.
It's unheard of. It's heresey.

On a side not, before parsing my arrays in code I always go through
and remove null values because they foul up iteration. The point is
you will not have NULL in this situation, nor will you ever care about
NULL values in an array.
On 11/8/05, Ben Ramsey [EMAIL PROTECTED] wrote:
 On 11/8/05 11:52 PM, Ben Ramsey wrote:
  I know this is off-topic for this thread, but just as I see isset()
  misused (as in this case), I often see empty() misused. For example,
  when using empty(), the following all return TRUE:

 On second thought, misused is the wrong word. I mean misunderstood.

 --
 Ben Ramsey
 http://benramsey.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] Re: Session's across Domains...

2005-11-09 Thread Tony Di Croce
Hmm.. Almost.

If the shopping cart on site A submits to the secure CC processing page on
site B, then the contextual data that describes the order (price, order
number) was actually communicated from A to B via a hop at the users browser
(likely via a hidden form field on site A). Thus it would need to be
encrypted and urlencoded (otherwise anyone could hit View Source and see
it all in plain text).

Now, I suppose the shopping cart on site A could submit to itself, and then
in that case, build up this encrypted data packet and then re-direct to the
secure CC processing page (passing the encrypted data as a GET parameter. Is
their any way to POST with a re-direct?).

Ok. I think I have this all in my head now.

On 11/9/05, Ben Ramsey [EMAIL PROTECTED] wrote:

 I'm posting this back to the list to keep the conversation there. I hope
 you don't mind. My comments are at the bottom . . .


 On 11/9/05 10:10 AM, Tony Di Croce wrote:
  The reason I even wanted to do this had more to do with sharing some
  data between two sites, and less with really maintaining a login.
 
  It occured to me that I need not share sessions at all. Instead, all
  of the data B needs could simply be encrypted by A and sent in a post
 field.
 
  Now, this does bring up the problem that someone could sniff this
  packet, capture this encrypted packet, and use it to authenticate
  themselves on B. They never had to decrypt it, just capture from A, and
  send to B at their leisure...
 
  Let me give some background here on exactly what I'm doing, as it may
  clear things up a bit.
 
  B is a secure page, with a CC info form that when submitted will process
  their card, charging the amount of money passed in the encrypted packet,
  and if the charge succeeds, redirecting back to A. A would probably need
  to send an order number to B, and B could pass that back to A upon
  success or failure.
 
  All of this is to get around the Apache limitation of allowing only one
  virtual host to use SSL.
 
  Anyhow, B could keep track of all of the order numbers it was sent by A,
  and if it was re-sent a duplicate could simply deny the whole
  transaction. Thus, if someone sniffed my encrypted data burrito, and
  attempted to re-use it to gain access to B, they would fail, since B
  will only allow that burrito ONCE. Perhaps these order numbers could be
  GUID's.
 
  How does this sound?

 I think someone else here could probably offer some better advice, but
 here's what I would do.

 I would definitely use SSL when dealing with CC data, but I don't think
 there's an Apache limitation that restricts the use of SSL to one host.
 There is a limitation that restricts the use of an SSL certificate to
 one host, so, if you had two certificates, both hosts could use SSL
 sockets, but I don't think that's what you need here. (You could still
 use the same certificate across multiple hosts, but then the user is
 going to be prompted in the browser whether or no to allow the
 certificate to be used, and this is generally not a good idea.)

 What you need to do is ensure that your FORM action on domain A (the
 unsecured domain) is POSTing to https://domain-b.org. Note the usage of
 HTTPS. This will ensure that the data is sent along the secure channel
 and not in clear text. You don't need to perform any encryption, since
 SSL takes care of that for you.

 Then, B could simply redirect back to A after processing the order and
 pass the order number through the query string (since it's probably not
 very sensitive).

 Does this answer your question?

 And, yeah, denying used order numbers would be a good idea.

 --
 Ben Ramsey
 http://benramsey.com/




--
for only the most hard core geekstas...
http://geekstasparadise.blogspot.com


Re: [PHP] Re: Session's across Domains...

2005-11-09 Thread M

Ben Ramsey wrote:
B is a secure page, with a CC info form that when submitted will 
process their card, charging the amount of money passed in the 
encrypted packet, and if the charge succeeds, redirecting back to A. A 
would probably need to send an order number to B, and B could pass 
that back to A upon success or failure.


All of this is to get around the Apache limitation of allowing only 
one virtual host to use SSL.


apache does not have this limit. this is limit of https protocol, 
because encryption takes place before any request is made, so the only 
way to know what SSL certificate to use is the IP address. You can get 
apache to listen on more than one IP and use as many certificates as you 
like.




Anyhow, B could keep track of all of the order numbers it was sent by 
A, and if it was re-sent a duplicate could simply deny the whole 
transaction. Thus, if someone sniffed my encrypted data burrito, and 
attempted to re-use it to gain access to B, they would fail, since B 
will only allow that burrito ONCE. Perhaps these order numbers could 
be GUID's.


You can look at how payment gateways do this. There are basicly 2 ways:

1. postback - when user is redirected from B to A with the result status 
and order id, A asks B (rpc, simple get method, anything...) if the 
result is really what it got from the user. Check every important 
information - order id, amount


2. signing - site B computes a sign from important information of the 
transaction (at least order id and amount) and a secret key, and adds 
this sign to the redirect url that leads to site A. Site A can then 
compute the sign from the same values and check it against sign received 
from the server.


In both cases you should also incorporate site id, so site A is not the 
only one that can use the interface of site B.


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



Re: [PHP] Re: Session's across Domains...

2005-11-09 Thread Ben Ramsey

On 11/9/05 11:05 AM, Tony Di Croce wrote:

If the shopping cart on site A submits to the secure CC processing page on
site B, then the contextual data that describes the order (price, order
number) was actually communicated from A to B via a hop at the users browser
(likely via a hidden form field on site A). Thus it would need to be
encrypted and urlencoded (otherwise anyone could hit View Source and see
it all in plain text).


Is the price and order number sensitive enough to encrypt? Like we've 
already discussed, the order number will be considered invalid once it's 
been processed, so any subsequent attempts to use the order number will 
result in a failed transaction. If the order number includes sensitive 
information, however (such as the full credit card number or something), 
then you should rethink how you create your order numbers.


You also don't need to urlencode anything in a form field. When you 
submit the form, the browser handles the urlencoding for you. (If you 
were POSTing from a script, then, yes, you might need to urlencode it.)


As for the other question about POSTing on a redirect, it is possible 
through several different means, and if this is a route you want to 
take, I would suggest looking at PEAR::HTTP_Request, since it provides 
an easy to use API for this. I, however, don't think you'll need to do 
this (at least it doesn't sound like something that's necessary given 
what I know about your form).


--
Ben Ramsey
http://benramsey.com/

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



Re: [PHP] java .vs php

2005-11-09 Thread Armando Afá

Hi bruce,

Programming can be as good as the programer can be. If you look at the 
google site, how it works, how many concurrent processes that code can 
do, you realize that tools available for this purposes (Phyton, Perl, 
PHP java) do what you want them to do.


Just try to take a look to them and then pick up your tool.

In 5 words. It is Up to you

bruce wrote:


hi...

php appears to be fine/good for prototyping. my question; does anybody have
testing experience regarding scalability of php .vs java. ie, can php scale
to handle 1000s of simultaneous connections/users, as well as deal with the
various security issues...

articles dealing with actual live test data would be helpful. i'd also be
interested in hearing from your experience if you've actually had to look
into this issue.

haven't really seen a lot of hard data on this via google.. lots of mine is
better than yours.. but i'm trying to really get a feel as to whether php
can really drive serious commercial sites...

thanks

-bruce
[EMAIL PROTECTED]

 



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



Re: [PHP] java .vs php

2005-11-09 Thread Rosty Kerei
 Yahoo gets 3.4 billion page views per day. That serious enough for you?


I can't believe that Yahoo! works on PHP. Any proofs?
As I know they use their own-written engine, if I'm correct it's called 
yScript. Am I right? 

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



Re: [PHP] phpmyadmin problems with quoting exported text

2005-11-09 Thread Chris W

Richard Lynch wrote:


On Sun, November 6, 2005 2:17 am, Chris W wrote:
 


I just tried to use the output of the export function on phpmyadmin
and
got a million errors.  After looking at the file I found that certain
columns that are strings were not quoted at all.  I can't find any
reason why some are and some are not quoted.  Anyone have any idea why
this is happening?
   



Because unless a field contains a ',' or '' character, it doesn't
NEED quotes to delineate it:

1,test,3
1,I said,It's not the same,3

is the same thing as:
1,test,3
1,I said,It's not the same,3

Your import function is BROKEN in a major way, by requiring quotes
where they are not strictly necessary to conform to the CSV
specification.

That said, it's probably easier to get phpMyAdmin to always quote the
output than it is to fix whatever broken import tool you are using.

 

The program I am using to import the data is the MySQL tools.  They 
don't like the output of phpMyAdmin 2.6.1-rc1.   And I don't have any 
control over the server so I can't upgrade the version either.  Unless I 
find a work around, I'm SOL


--
Chris W
KE5GIX

Gift Giving Made Easy
Get the gifts you want  
give the gifts they want
One stop wish list for any gift, 
from anywhere, for any occasion!

http://thewishzone.com

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



Re: [PHP] java .vs php

2005-11-09 Thread Ben Ramsey

On 11/9/05 11:58 AM, Rosty Kerei wrote:

Yahoo gets 3.4 billion page views per day. That serious enough for you?


I can't believe that Yahoo! works on PHP. Any proofs?
As I know they use their own-written engine, if I'm correct it's called 
yScript. Am I right? 


Try here for your proof: 
http://public.yahoo.com/~radwin/talks/php-at-yahoo-zend2005.pdf


--
Ben Ramsey
http://benramsey.com/

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



RE: [PHP] java .vs php

2005-11-09 Thread Jay Blanchard
[snip]
 Yahoo gets 3.4 billion page views per day. That serious enough for you?


I can't believe that Yahoo! works on PHP. Any proofs?
As I know they use their own-written engine, if I'm correct it's called 
yScript. Am I right? 
[/snip]

You 'were' right...up until 2002

http://news.com.com/2100-1023-963937.html?tag=lh

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



Re: [PHP] java .vs php

2005-11-09 Thread Richard Lynch
On Wed, November 9, 2005 9:40 am, bruce wrote:
 php appears to be fine/good for prototyping. my question; does anybody
 have
 testing experience regarding scalability of php .vs java. ie, can php
 scale
 to handle 1000s of simultaneous connections/users, as well as deal
 with the
 various security issues...

PHP and Java scale up in a rather different manner.

PHP itself is generally based on a shared nothing architecture.

Need more web bandwidth ; buy more cheap hardware.

At the backend of the web, you probably have some kind of other
services, usually a database, and frequently some other processes that
must share data of some sort.

Java tends to throw that into its Framework, and that Framework
provides a nexus through which resource allocation/utilization is
managed.

In PHP, you are expected to choose your own preferred resource
management plan.

Both can scale as large as you can afford to buy hardware, and as much
as your skill allows you to maximize your hardware ROI.

 articles dealing with actual live test data would be helpful. i'd also
 be
 interested in hearing from your experience if you've actually had to
 look
 into this issue.

 haven't really seen a lot of hard data on this via google.. lots of
 mine is
 better than yours.. but i'm trying to really get a feel as to whether
 php
 can really drive serious commercial sites...

Obviously it can because it does.

You've already been given an example, and refuse to believe it.  There
would seem to be little point to giving more examples.

You can choose PHP or Java or both and provide whatever services you want

#30#

-- 
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] to the freelancers!!

2005-11-09 Thread Richard Lynch
On Wed, November 9, 2005 7:59 am, bruce wrote:
 you miss a key nuance/point to the msg. her idea/thought was twofold.
 1)
 whether companies would have ideas/projects that they would be
 interested in
 partially funding, and 2) if there would be a 'talented' pool of
 developers
 who would be interested in working on the initial apps.

H.  My answer must have confused rather than clarified.

The answer to both of these questions is Yes

The issue is, who is willing and has the skills to take this idea and
to execute the actions needed to make it work?

http://www.oreillynet.com/pub/wlg/7614

-- 
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] phpmyadmin problems with quoting exported text

2005-11-09 Thread Richard Lynch
On Wed, November 9, 2005 11:05 am, Chris W wrote:
 Richard Lynch wrote:

On Sun, November 6, 2005 2:17 am, Chris W wrote:


I just tried to use the output of the export function on phpmyadmin
and
got a million errors.  After looking at the file I found that
 certain
columns that are strings were not quoted at all.  I can't find any
reason why some are and some are not quoted.  Anyone have any idea
 why
this is happening?



Because unless a field contains a ',' or '' character, it doesn't
NEED quotes to delineate it:

1,test,3
1,I said,It's not the same,3

is the same thing as:
1,test,3
1,I said,It's not the same,3

Your import function is BROKEN in a major way, by requiring quotes
where they are not strictly necessary to conform to the CSV
specification.

That said, it's probably easier to get phpMyAdmin to always quote the
output than it is to fix whatever broken import tool you are using.



 The program I am using to import the data is the MySQL tools.  They
 don't like the output of phpMyAdmin 2.6.1-rc1.   And I don't have any
 control over the server so I can't upgrade the version either.  Unless
 I
 find a work around, I'm SOL

You could probably import into something smart enough to handle the
missing quotes, then export with a setting that always quotes.

I believe Excel (gak!) would do this correctly.

PHP's http://php.net/fgetcsv might do the right thing, and you could
write out the CSV any which way you want... Or, at that point, just
write an INSERT query.

Which route to take depends how big the file is, and how often you
have to do this and what tools you are familiar with.

-- 
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



[PHP] Unable to send variables to MySQL table

2005-11-09 Thread Stewart Priest
Hi folks... a bit of a newbie question I'm afraid...

I've written this script shown below. It gets its variables from a form, and 
then it (supposedly!) writes these values into a MySQL table ('invoices').

The script executes with no errors, but when I check the table, the table is 
still empty. I can manually insert the data directly into the table, and when I 
echo the variables in the script, the values are displayed whe I run it, but 
for reasons unknown, the values are not written to the table.

Any ideas? The code is below.

Many thanks.
Stewart

?php

// this opens the connection to the db
include 'library/opendb.php';

// this adds detals to the invoice table
$item1_desc = $_REQUEST['item1_desc'];
$item2_desc = $_REQUEST['item2_desc'];
$item3_desc = $_REQUEST['item3_desc'];
$item4_desc = $_REQUEST['item4_desc'];
$item1_cost = $_REQUEST['item1_cost'];
$item2_cost = $_REQUEST['item2_cost'];
$item3_cost = $_REQUEST['item3_cost'];
$item4_cost = $_REQUEST['item4_cost'];
$delivery_cost = $_REQUEST['delivery_cost'];

$add_to_db = insert into invoices (item1_desc, item1_cost, item2_desc, 
item2_cost, item3_desc, item3_cost, item4_desc, item4_cost, delivery_cost) 
values ('$item1_desc', '$item1_cost', '$item2_desc', '$item2_cost', 
'$item3_desc', '$item3_cost', '$item4_desc', '$item4_cost', '$delivery_cost');
mysql_query($add_to_db);

?

RE: [PHP] Unable to send variables to MySQL table

2005-11-09 Thread Jay Blanchard
[snip]
Any ideas? The code is below.
[/snip]

Does your MySQL connection have permission to insert to the table?

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



[PHP] Re: Unable to send variables to MySQL table

2005-11-09 Thread Ben Ramsey

On 11/9/05 2:15 PM, Stewart Priest wrote:

?php

// this opens the connection to the db
include 'library/opendb.php';

// this adds detals to the invoice table
$item1_desc = $_REQUEST['item1_desc'];
$item2_desc = $_REQUEST['item2_desc'];
$item3_desc = $_REQUEST['item3_desc'];
$item4_desc = $_REQUEST['item4_desc'];
$item1_cost = $_REQUEST['item1_cost'];
$item2_cost = $_REQUEST['item2_cost'];
$item3_cost = $_REQUEST['item3_cost'];
$item4_cost = $_REQUEST['item4_cost'];
$delivery_cost = $_REQUEST['delivery_cost'];

$add_to_db = insert into invoices (item1_desc, item1_cost, item2_desc, item2_cost, 
item3_desc, item3_cost, item4_desc, item4_cost, delivery_cost) values ('$item1_desc', 
'$item1_cost', '$item2_desc', '$item2_cost', '$item3_desc', '$item3_cost', '$item4_desc', 
'$item4_cost', '$delivery_cost');
mysql_query($add_to_db);

?


Comment out the mysql_query() line and just echo $add_to_db. Then take 
the echoed line and try to run it against the database. Does it still 
work, then?


--
Ben Ramsey
http://benramsey.com/

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



Re: [PHP] Unable to send variables to MySQL table

2005-11-09 Thread Richard Davey
Hi Stewart,

Wednesday, November 9, 2005, 7:15:39 PM, you wrote:

 The script executes with no errors, but when I check the table, the
 table is still empty. I can manually insert the data directly into
 the table, and when I echo the variables in the script, the values
 are displayed whe I run it, but for reasons unknown, the values are not 
 written to the table.

 $add_to_db = insert into invoices (item1_desc, item1_cost,
 item2_desc, item2_cost, item3_desc, item3_cost, item4_desc,
 item4_cost, delivery_cost) values ('$item1_desc', '$item1_cost',
 '$item2_desc', '$item2_cost', '$item3_desc', '$item3_cost',
 '$item4_desc', '$item4_cost', '$delivery_cost');
 mysql_query($add_to_db);

?

On the surface it looks fine, so I would echo out your query and then
paste it into MySQL (phpmyamin, SQLyog, etc) and check it works!

Or you could capture the result of the query and check for an error.

If there isn't one, it's probably a table design issue.

Cheers,

Rich
-- 
Zend Certified Engineer
PHP Development Services
http://www.corephp.co.uk

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



Re: [PHP] Unable to send variables to MySQL table

2005-11-09 Thread Dan McCullough
print $add_to_db;

should print out the entire insert line and you can just double check
that your values are full, otherwise like Jay said I would check and
make sure the user you have in your connect string can write to the
db.

On 11/9/05, Stewart Priest [EMAIL PROTECTED] wrote:
 Hi folks... a bit of a newbie question I'm afraid...

 I've written this script shown below. It gets its variables from a form, and 
 then it (supposedly!) writes these values into a MySQL table ('invoices').

 The script executes with no errors, but when I check the table, the table is 
 still empty. I can manually insert the data directly into the table, and when 
 I echo the variables in the script, the values are displayed whe I run it, 
 but for reasons unknown, the values are not written to the table.

 Any ideas? The code is below.

 Many thanks.
 Stewart

 ?php

 // this opens the connection to the db
 include 'library/opendb.php';

 // this adds detals to the invoice table
 $item1_desc = $_REQUEST['item1_desc'];
 $item2_desc = $_REQUEST['item2_desc'];
 $item3_desc = $_REQUEST['item3_desc'];
 $item4_desc = $_REQUEST['item4_desc'];
 $item1_cost = $_REQUEST['item1_cost'];
 $item2_cost = $_REQUEST['item2_cost'];
 $item3_cost = $_REQUEST['item3_cost'];
 $item4_cost = $_REQUEST['item4_cost'];
 $delivery_cost = $_REQUEST['delivery_cost'];

 $add_to_db = insert into invoices (item1_desc, item1_cost, item2_desc, 
 item2_cost, item3_desc, item3_cost, item4_desc, item4_cost, delivery_cost) 
 values ('$item1_desc', '$item1_cost', '$item2_desc', '$item2_cost', 
 '$item3_desc', '$item3_cost', '$item4_desc', '$item4_cost', 
 '$delivery_cost');
 mysql_query($add_to_db);

 ?


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



RE: [PHP] Unable to send variables to MySQL table

2005-11-09 Thread Jim Moseby
snippity snip
 
 Any ideas? The code is below.
snip snip
 mysql_query($add_to_db);

Hi Stewart.  Your query is failing for some reason (as others here have
mentioned). I would change the above line to read:

mysql_query($add_to_db) or die(mysql_error().br$add_to_db);

This will make the script die, and will print the mysql error and the SQL
statement that caused it.

JM

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



Re: [PHP] Unable to send variables to MySQL table

2005-11-09 Thread Stewart Priest
snip
print $add_to_db;
/snip

Thanks for all your replies! I didn't expect to get one so quick, so thanks!

After I did the above, I pasted the output into MySQL. Guess what? It didn't
work!

I was only sending values for $item1_desc and $item1_cost. Because I was not
sending values for the other columns, I was getting an error message saying
the data was truncated for the empty variables.

Now I need to figure out how to send empty values... would NULL do the job?

Thanks again!
Stewart

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



Re: [PHP] Unable to send variables to MySQL table

2005-11-09 Thread Dan McCullough
What is the structure of that table?

On 11/9/05, Stewart Priest [EMAIL PROTECTED] wrote:
 snip
 print $add_to_db;
 /snip

 Thanks for all your replies! I didn't expect to get one so quick, so thanks!

 After I did the above, I pasted the output into MySQL. Guess what? It didn't
 work!

 I was only sending values for $item1_desc and $item1_cost. Because I was not
 sending values for the other columns, I was getting an error message saying
 the data was truncated for the empty variables.

 Now I need to figure out how to send empty values... would NULL do the job?

 Thanks again!
 Stewart

 --
 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] Unable to send variables to MySQL table

2005-11-09 Thread lonewolf
I code all my apps to look for an empty variable and dump and empty set
into it.  That way when I code the rest of the information into the
database, the files are cleaner and I don't have to worry about users
and bad sets.

$var = '';

Robert

- Original Message -
From: Stewart Priest [EMAIL PROTECTED]
Date: Wednesday, November 9, 2005 2:43 pm
Subject: Re: [PHP] Unable to send variables to MySQL table

 snip
 print $add_to_db;
 /snip
 
 Thanks for all your replies! I didn't expect to get one so quick, 
 so thanks!
 
 After I did the above, I pasted the output into MySQL. Guess what? 
 It didn't
 work!
 
 I was only sending values for $item1_desc and $item1_cost. Because 
 I was not
 sending values for the other columns, I was getting an error 
 message saying
 the data was truncated for the empty variables.
 
 Now I need to figure out how to send empty values... would NULL do 
 the job?
 
 Thanks again!
 Stewart
 
 -- 
 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] security code

2005-11-09 Thread lonewolf
www.phpclasses.org - There was just one pushed out recently in fact.  I
am not sitting in front of my archive or I could give you a direct URL
to it, but they have them there.

If you can't find it there, email me back directly and I'll send the
link when I get back from my conference.

Robert

- Original Message -
From: Clive [EMAIL PROTECTED]
Date: Wednesday, November 9, 2005 0:53 am
Subject: [PHP] security code

 Hi
 does any one have a class/function to generate those security code 
 images.
 Yhe ones that you see on website that you must enter to submit a form
 
 thanks
 
 clive
 
 -- 
 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[2]: [PHP] Creating PDF from a Image

2005-11-09 Thread Jens Schulze

Richard ([EMAIL PROTECTED]) wrote:


 http://php.net/gd
 This will let you imagecreatefromgif() and then imagejpeg()

I didn't find any mentioning, that the imagejpeg function supports
conversion to CMYK, so it is most liky that it will not help the
original poster. ImageMagick is the way to go... ;-)

Jens

-- 
This mail was scanned by AntiVir Milter.
This product is licensed for non-commercial use.
See www.antivir.de for details.

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



[PHP] T_PAAMAYIM_NEKUDOTAYIM

2005-11-09 Thread Unknown Unknown
I was working with objects, and suddenly i got this error:
*Parse error*: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in *
D:\Apache\Apache(re)\Apache2\htdocs\Include.php* on line *11*
is this like a bug in PHP or is it a valid error?
thanks in advance


Re: [PHP] Unable to send variables to MySQL table

2005-11-09 Thread Stewart Priest
snip
What is the structure of that table?
/snip

+---+--+--+-+-+---+
| Field | Type | Null | Key | Default | Extra |
+---+--+--+-+-+---+
| invoice_no| int(10)  | YES  | | NULL|   |
| item1_desc| varchar(255) | YES  | | NULL|   |
| item1_cost| float| YES  | | NULL|   |
| item2_desc| varchar(255) | YES  | | NULL|   |
| item2_cost| float| YES  | | NULL|   |
| item3_desc| varchar(255) | YES  | | NULL|   |
| item3_cost| float| YES  | | NULL|   |
| item4_desc| varchar(255) | YES  | | NULL|   |
| item4_cost| float| YES  | | NULL|   |
| delivery_cost | float| YES  | | NULL|   |
| customer_id   | int(10)  | YES  | | NULL|   |
| comments  | varchar(255) | YES  | | NULL|   |
+---+--+--+-+-+---+

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



RE: [PHP] T_PAAMAYIM_NEKUDOTAYIM

2005-11-09 Thread Jay Blanchard
[snip]
I was working with objects, and suddenly i got this error:
*Parse error*: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in *
D:\Apache\Apache(re)\Apache2\htdocs\Include.php* on line *11*
is this like a bug in PHP or is it a valid error?
thanks in advance
[/snip]

It means that you have two colons not being used correctly
http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php

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



Re: [PHP] T_PAAMAYIM_NEKUDOTAYIM

2005-11-09 Thread Curt Zirzow
On Wed, Nov 09, 2005 at 04:27:08PM -0500, Unknown Unknown wrote:
 I was working with objects, and suddenly i got this error:
 *Parse error*: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in *
 D:\Apache\Apache(re)\Apache2\htdocs\Include.php* on line *11*
 is this like a bug in PHP or is it a valid error?

It is a valid. The T_PAAMAYIM_NEKUDOTAYIM is refering to a the
double colon (::) token. You would get that error if you use it
wrong, like:

  'foo'::bar;

Btw, Paamayim Nekudotayim means double colon in hebrew.

Curt.
-- 

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



Re: [PHP] T_PAAMAYIM_NEKUDOTAYIM

2005-11-09 Thread Dan McCullough
t_paamayim_nekudotayim is Hebrew for term twice colon
I believe that its saying that you need to use the :: operator.

On 11/9/05, Unknown Unknown [EMAIL PROTECTED] wrote:
 I was working with objects, and suddenly i got this error:
 *Parse error*: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in *
 D:\Apache\Apache(re)\Apache2\htdocs\Include.php* on line *11*
 is this like a bug in PHP or is it a valid error?
 thanks in advance



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



Re: [PHP] T_PAAMAYIM_NEKUDOTAYIM

2005-11-09 Thread Unknown Unknown
Ah yes that fixed it, thanks


Re: [PHP] T_PAAMAYIM_NEKUDOTAYIM

2005-11-09 Thread tg-php
Yay!  Useless Trivia Time!

That big nasty word is apparently the name for ::.  Here's a PHP manual page 
explaining how it's used.  I'd recommend looking for a misuse of the :: 
operator in your code.

http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php


Enjoy!

-TG

= = = Original message = = =

I was working with objects, and suddenly i got this error:
*Parse error*: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in *
D:\Apache\Apache(re)\Apache2\htdocs\Include.php* on line *11*
is this like a bug in PHP or is it a valid error?
thanks in advance


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

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



RE: [PHP] T_PAAMAYIM_NEKUDOTAYIM

2005-11-09 Thread Jim Moseby
 
 Btw, Paamayim Nekudotayim means double colon in hebrew.
 

I suppose it would be an insult of the highest order to call a Hebrew man
and his brother Paamayim Nekudotayim.

JM

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



Re: [PHP] java .vs php

2005-11-09 Thread Esteamedpw
Look at the Thousand and Thousands of vBulletin boards, PHPBB's and other  
PHP/MySQL based BB Systems out there with several thousand Members on at once,  
not including guests. I know Yahoo! uses PHP and I've heard Google does as  
well?


Re: [PHP] Unable to send variables to MySQL table

2005-11-09 Thread M

Stewart Priest wrote:

snip
What is the structure of that table?
/snip

+---+--+--+-+-+---+
| Field | Type | Null | Key | Default | Extra |
+---+--+--+-+-+---+
| invoice_no| int(10)  | YES  | | NULL|   |
| item1_desc| varchar(255) | YES  | | NULL|   |
| item1_cost| float| YES  | | NULL|   |
| item2_desc| varchar(255) | YES  | | NULL|   |
| item2_cost| float| YES  | | NULL|   |
| item3_desc| varchar(255) | YES  | | NULL|   |
| item3_cost| float| YES  | | NULL|   |
| item4_desc| varchar(255) | YES  | | NULL|   |
| item4_cost| float| YES  | | NULL|   |
| delivery_cost | float| YES  | | NULL|   |
| customer_id   | int(10)  | YES  | | NULL|   |
| comments  | varchar(255) | YES  | | NULL|   |
+---+--+--+-+-+---+



This is not a good structure. Have you thought about taking item* 
columns to a separate table?


Table invoices:
+---+--+--+-+-+---+
| Field | Type | Null | Key | Default | Extra |
+---+--+--+-+-+---+
| invoice_no| int(10)  | YES  | | NULL|   |
| delivery_cost | float| YES  | | NULL|   |
| customer_id   | int(10)  | YES  | | NULL|   |
| comments  | varchar(255) | YES  | | NULL|   |
+---+--+--+-+-+---+

Table invoices_items:
+---+--+--+-+-+---+
| Field | Type | Null | Key | Default | Extra |
+---+--+--+-+-+---+
| item_no   | int(10)  | YES  | | NULL|   |
| invoice_no| int(10)  | YES  | | NULL|   |
| item_desc | varchar(255) | YES  | | NULL|   |
| item_cost | float| YES  | | NULL|   |
+---+--+--+-+-+---+

And columns should be able to hold NULL values only if they can be 
empty. I'm sure you don't want invoice_no to be NULL ;)


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



[PHP] Select and $_POST

2005-11-09 Thread Ross

What is the correct syntax for

$query = SELECT * FROM login where username='$_POST['username']' AND pass 
='$_POST['pass']';


Thought this would work.

R. 

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



RE: [PHP] Select and $_POST

2005-11-09 Thread Matt Babineau
$query = SELECT * FROM login WHERE username = '.$_POST['username'].' AND
pass = '. $_POST['pass'].';


 What is the correct syntax for
 
 $query = SELECT * FROM login where 
 username='$_POST['username']' AND pass ='$_POST['pass']';
 
 
 Thought this would work.
 
 R. 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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



Re: [PHP] Re: Richard Lynch's Email Address ...

2005-11-09 Thread GamblerZG

I'm using this, but I'm not sure whether it's bug-free:
preg_match('/^([.0-9a-z_+-]+)@([0-9a-z-]+\.)+[0-9a-z]{2,6}$/i', $email);

Note: IIRC, PEAR function will invalidate all adresses in museum TLD.

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



[PHP] Re: Select and $_POST

2005-11-09 Thread Ben Ramsey

On 11/9/05 6:21 PM, Ross wrote:

What is the correct syntax for

$query = SELECT * FROM login where username='$_POST['username']' AND pass 
='$_POST['pass']';



Thought this would work.

R. 


The correct syntax in this case is actually:

$query = SELECT * FROM login where username='{$_POST['username']}' AND 
pass='{$_POST['pass']}';


Note the curly braces.

BUT! Never do this!

For example, consider if someone typed in their username like this:

foo' AND 1=1 --

The -- in most database engines starts a comment, so the query would 
end up being:


SELECT * FROM login where username='foo' AND 1=1 --' AND pass=''

Everything after the -- is ignored. There doesn't have to be a user 
named foo because 1 will always equal 1, so the user is instantly 
logged in.


Instead, filter your input (data received) and escape your output (in 
this case, data going to the database), and try something like this:


?php
$clean = array();
$sql   = array();

if (ctype_alnum($_POST['username']))
{
$clean['username'] = $_POST['username'];
}

if (ctype_alnum($_POST['pass']))
{
$clean['pass'] = $_POST['pass'];
}

if (isset($clean['username']))
{
$sql['username'] = mysql_real_escape_string($clean['username']);
}

if (isset($clean['pass']))
{
$sql['pass'] = mysql_real_escape_string($clean['pass']);
}

$query = SELECT * FROM login where username='{$sql['username']}' AND 
pass='{$sql['pass']}';


?

Everything in $_POST should be treated as tainted data. Everything in 
$clean can be treated as valid and untainted. This ensures that the 
username and password received only contain values that you expect. You 
can modify the filtering to suit your needs. Then, it ensures that data 
sent to the database in the SQL statement is always escaped so that it 
doesn't try to do something it shouldn't.


This, of course, assumes you're using MySQL, but there are other 
escaping functions for other databases. Just look in the PHP manual.


--
Ben Ramsey
http://benramsey.com/

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



[PHP] Re: Richard Lynch's Email Address ...

2005-11-09 Thread GamblerZG

James Benson wrote:

Would it not be better something like valid_email()


email_validate()?

Anyway, I agree that PHP needs such function.

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



[PHP] Re: Richard Lynch's Email Address ...

2005-11-09 Thread Ben Ramsey

On 11/9/05 7:20 PM, GamblerZG wrote:

James Benson wrote:


Would it not be better something like valid_email()


email_validate()?

Anyway, I agree that PHP needs such function.


Check out http://pecl.php.net/package/filter

?php
$clean['email'] = input_get(INPUT_POST, 'email', FL_EMAIL);
?

I've been playing around with this for a while, and it should be noted 
that it's still in beta and should not be used in a production 
environment, but it's a promising step. The e-mail regex that's used 
isn't perfect, and it won't support RFC-compliant addresses, but I hope 
to put a little bit of work into it to help out with this.


In the meantime, check out PEAR::Mail, which includes Mail_RFC822 that 
can be used to validate e-mail addresses. Also, if your PHP is compiled 
--with-imap, then you can use imap_rfc822_parse_adrlist() to validate 
e-mail addresses.


--
Ben Ramsey
http://benramsey.com/

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



Re: [PHP] Select and $_POST

2005-11-09 Thread Terence



Ross wrote:

What is the correct syntax for

$query = SELECT * FROM login where username='$_POST['username']' AND pass 
='$_POST['pass']';



Thought this would work.

R. 

Search for SQL Injection and see why what you're doing is very 
dangerous. Google is your friend.


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



Re: [PHP] Select and $_POST

2005-11-09 Thread Chris Shiflett

Ross wrote:

$query = SELECT * FROM login where username='$_POST['username']' AND
pass ='$_POST['pass']';


You have to use curly braces in order to interpolate an array:

$string = ...{$array['foo']} ...;

By the way, my favorite username is this:

chris' --

That's what all my friends call me. :-)

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

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



Re: [PHP] Select and $_POST

2005-11-09 Thread Curt Zirzow
On Wed, Nov 09, 2005 at 11:21:36PM -, Ross wrote:
 
 What is the correct syntax for
 
 $query = SELECT * FROM login where username='$_POST['username']' AND pass 
 ='$_POST['pass']';
 

?php
if (get_magic_quotes_gpc()) {
  $_POST['username'] = stripslashes($_POST['username']);
  $_POST['pass'] = stripslashes($_POST['pass']);
}

/* where dbdriver is mysql[_real] or pg, etc.. */
$username = dbdriver_escape_string($_POST['username']);
$pass = dbdriver_escape_string($pass);

$query = SELECT * FROM login 
  WHERE username = '$username' AND pass = '$pass';


Curt.
-- 

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



[PHP] Gotta learn asp.net...

2005-11-09 Thread Joseph Szobody
*sigh* I'm a hardcore PHP programmer.. I've been using it for over five 
years now, and would consider myself fairly advanced. I have a project where 
I'm being forced to do some ASP.NET development, which I've never touched. I 
need to learn it fast.

I'm thinking there must be some other folks around here who have been in 
similar situations. I'm looking for some pointers on good learning 
resources, specifically for someone who is an experienced PHP programmer, 
but who knows nothing about .NET. What helped you most in adapting your PHP 
skills for .NET?

Hope this is an appropriate question here.

Joseph 

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



Re: [PHP] Gotta learn asp.net...

2005-11-09 Thread Esteamedpw
VTC.com has some ASP tutorials... you can get their Monthly University  
program for $30.00 a month?


Re: [PHP] Re: Select and $_POST

2005-11-09 Thread Chris Shiflett

Ben Ramsey wrote:

$clean = array();
$sql   = array();


Glad to see someone spreading this habit. :-) Thanks, Ben.


if (ctype_alnum($_POST['pass']))
{
$clean['pass'] = $_POST['pass'];
}


I think it's fine to cheat a bit with the password and trust the output 
format of md5():


$clean['pass'] = md5($_POST['pass']);

Of course, it is best to use a salt:

$salt = 'SHIFLETT';
$clean['pass'] = md5($salt . md5($_POST['pass'] . $salt));

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

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



[PHP] Error in reading and writing bytes

2005-11-09 Thread kumar kumar
Hi
i am new to PHP .I am facing some problems .
Here is the code below

Here the applet will send the files thru http . files
from 30 bytes   to 2 GB.

?php

$logfile = C:/temp/log1.txt;
$log = fopen($logfile,a+);

fwrite($log, Executing PHP Script \r\n);

$save_path  = $_REQUEST['DATADIR'];
$filepath = $_REQUEST['FILEPATH'];
$filename = $_REQUEST['FILENAME'];

$fname = $save_path$filepath$filename;
$tdir =$save_path.$filepath;

mkMDir($tdir);

  function  mkMDir($dir,$dirmode=0777)
  {
if (!empty($dir)) {
if (!file_exists($dir)) {
   preg_match_all('/([^\/]*)\/?/i', $dir,$tmp);
   $default=;
  
  foreach ($tmp[0] as $key=$val) {
   $default=$default.$val;
  
   if(!file_exists($default))
   if (!mkdir($default,$dirmode)) {
   return -1;
   }
   }
   }else if (!is_dir($dir)){
   return -2;
 }
   }
   return 0;
   }


  $fp = fopen($fname,w);

  $getdata = fopen(php://input, r);

  fwrite($log, $fname Uploaded Successfully \r\n);


while (strlen($data = fread($getdata,8192))  0) {
fwrite($fp,$data);  
}

fclose($fp);
fclose($getdata);
fclose($log);
?

I tried this one its working for bigger files , but
its not working for small files less than 7 MB i am
unable to track the error or reason.and some times its
writing the less amount of bytes(60MB) then the
original one(90MB).

If possible please go thru this code and suggest me
the changes.

Thanking you
With Regards
Kumar



 






__ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

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



[PHP] Error in reading and writing bytes

2005-11-09 Thread kumar kumar
Hi
i am new to PHP .I am facing some problems .
Here is the code below

Here the applet will send the files thru http . files
from 30 bytes   to 2 GB.

?php

$logfile = C:/temp/log1.txt;
$log = fopen($logfile,a+);

fwrite($log, Executing PHP Script \r\n);

$save_path  = $_REQUEST['DATADIR'];
$filepath = $_REQUEST['FILEPATH'];
$filename = $_REQUEST['FILENAME'];

$fname = $save_path$filepath$filename;
$tdir =$save_path.$filepath;

mkMDir($tdir);

  function  mkMDir($dir,$dirmode=0777)
  {
if (!empty($dir)) {
if (!file_exists($dir)) {
   preg_match_all('/([^\/]*)\/?/i', $dir,$tmp);
   $default=;
  
  foreach ($tmp[0] as $key=$val) {
   $default=$default.$val;
  
   if(!file_exists($default))
   if (!mkdir($default,$dirmode)) {
   return -1;
   }
   }
   }else if (!is_dir($dir)){
   return -2;
 }
   }
   return 0;
   }


  $fp = fopen($fname,w);

  $getdata = fopen(php://input, r);

  fwrite($log, $fname Uploaded Successfully \r\n);


while (strlen($data = fread($getdata,8192))  0) {
fwrite($fp,$data);  
}

fclose($fp);
fclose($getdata);
fclose($log);
?

I tried this one its working for bigger files , but
its not working for small files less than 7 MB i am
unable to track the error or reason.and some times its
writing the less amount of bytes(60MB) then the
original one(90MB).

If possible please go thru this code and suggest me
the changes.

Thanking you
With Regards
Kumar



 





__ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

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



[PHP] Re: php5 / php4 - MySQL/SQLite

2005-11-09 Thread Oliver Grätz
Danny schrieb:

  Let me open a discussion about php5 / php4
Fine. Let's keep it short ;-)

  Why upgrade?
Because you want support for proper OOP.
Most of the other changes can be like SQLite can also be used with PHP4.

 It worth?
If you see the benefits of interfaces, object overloading, autoloaders,
interceptors and/or exceptions: yes. If you want to do some simple
stuff:no. If you are starting to implement a large project: big yes.

 Benefits?
Example: I have a simple object-layer for my databases and relations. If
I have a table MEETING and a table USER and I have a reference table for
the USERS_IN_MEETING, then I can now

  $m=new DB_Meeting(12); // simply by id, other criteria possible
  foreach ($m-allAttendees as $user)
  {
mail($user['email'],'Invitation','Meeting: '.$m['description']);
  }

That's it! No queries, no nothing. And thanks to interceptors I could
implement this in very few lines of code.

 Code programming changes?
I doubt any of my new PHP5 code can be backported or properly simulated
in PHP4. If you really get into it, there are big changes on the
horizon. But if you want to keep programming the way you did: Nobody
keeps you from continuing this way with PHP5.

  Is there and end-of-life for php4, in the near/medium future?
I don't believe in that. There will certainly be no new features for the
PHP4 branch, but it will get security updates for quite some time and
hosting companies will continue to feature it for years to come.

  What about MySQL and SQLite. What is the future of both? I would like to
 open a discussion about the future of both related to php no matter the
 version of it...
SQLite: This is no comparison to MySQL because I think it fits totally
different problems. It's easier to use than MySQL because you don't have
to connect to a server. You can simply deploy the database as a file
with your application. But it is not as good when it comes to high
concurrency (meaning a lot of visitors). So:

- SQLite for small projects that are used by few users.
- MySQL for big web sites.

MySQL: Even if you stay with PHP4, please consider switching to the
mysqli objects. One benefit: They are more like the SQLite API so you
can get some synergy when learning both of them.

For PHP5: PHP5.1 will feature the first final version of PDO. PDO allows
to use MySQL and SQLite via one interface.

OLLi


Kajiggers!

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



[PHP] mod_rewrite, apache2, php5RC1 and osx bsd

2005-11-09 Thread Dan Rossi
Hi there, ive been having issues with mod_rewrite and apache2 with PHP 
5.1RC1. I have googled the php bugs and people have been experiencing 
the same issue however the php people cant see to reproduce the bug. 
Its most definately doing it for me, here is a rewrite rule i have 
setup, if i [L] to a php script, it either tries to download the faked 
url file or hangs.  I reverted back to 5.1.0b2 and it works fine ?? 
What do i do ?


RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/(.+\.(video))$ ../../phpscript.php

Re: [PHP] Error in reading and writing bytes

2005-11-09 Thread Curt Zirzow
On Wed, Nov 09, 2005 at 08:23:04PM -0800, kumar kumar wrote:
 Hi
 i am new to PHP .I am facing some problems .
 Here is the code below
 
 Here the applet will send the files thru http . files
 from 30 bytes   to 2 GB.
 
 ?php
 
 
   $getdata = fopen(php://input, r);
 ...
 
 while (strlen($data = fread($getdata,8192))  0) {
 fwrite($fp,$data);
 }
 ...
 
 I tried this one its working for bigger files , but
 its not working for small files less than 7 MB i am
 unable to track the error or reason.and some times its
 writing the less amount of bytes(60MB) then the
 original one(90MB).

This is a 2 part question with a 4 part answer.

First, it works for large files but not for files less than 7MB.
This is because php will automatically read the stdin for you base
on your php ini settings:

  max_post_size
  max_upload_size

Second, even if you increase that size, sometimes there is a limit
on how much data can be sent to the webserver, but usually you will
get a error response before the upload actually happens in most
cases.

Third,  php by default has a time limit on how long it is going to
run. By default it is 30 seconds, you can use the set_time_limit()
to adjust as needed.  Also, there is also timeout that can occur
within the webserver as well. If for some reason there is a lag in
the connection, the webserver will just assume the client is AWOL
and drop the connection.  I'd hate to see this happen at 89MB
transfer point.

Fourth, as why the 90MB file ends up being 60MB, your loop is all
wrong:

  while (strlen($data = fread($getdata,8192))  0) {

You are making a big mistake by assuming what strlen() of the fread
should be, you should loop based on when it hasn't reach end of file:

  while(! feof($getdata) ) {
$data = fread($getdata, 8192);
...
  }

With those 4 points being made I do wonder why you havn't used any
of the other already existing transfer methods, like ftp or sftp.
It seems like a lot of work your trying to do over http, a
protocol that wasn't really designed for large file transfers.
 

Curt.
--

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



Re: [PHP] mod_rewrite, apache2, php5RC1 and osx bsd

2005-11-09 Thread Curt Zirzow
On Thu, Nov 10, 2005 at 03:36:07PM +1100, Dan Rossi wrote:
 Hi there, ive been having issues with mod_rewrite and apache2 with PHP 
 5.1RC1. I have googled the php bugs and people have been experiencing 
 the same issue however the php people cant see to reproduce the bug. 
 Its most definately doing it for me, here is a rewrite rule i have 
 setup, if i [L] to a php script, it either tries to download the faked 
 url file or hangs.  I reverted back to 5.1.0b2 and it works fine ?? 
 What do i do ?
 
 RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/(.+\.(video))$ ../../phpscript.php

Well this is a really ugly Rewrite, i must say.

One thing to note is well 5.1RC4 has been available in Oct:
  http://downloads.php.net/ilia/

Curt.
-- 

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



Re: [PHP] mod_rewrite, apache2, php5RC1 and osx bsd

2005-11-09 Thread Dan Rossi


On 10/11/2005, at 4:18 PM, Curt Zirzow wrote:


On Thu, Nov 10, 2005 at 03:36:07PM +1100, Dan Rossi wrote:

Hi there, ive been having issues with mod_rewrite and apache2 with PHP
5.1RC1. I have googled the php bugs and people have been experiencing
the same issue however the php people cant see to reproduce the bug.
Its most definately doing it for me, here is a rewrite rule i have
setup, if i [L] to a php script, it either tries to download the faked
url file or hangs.  I reverted back to 5.1.0b2 and it works fine ??
What do i do ?

RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/(.+\.(video))$ 
../../phpscript.php


Well this is a really ugly Rewrite, i must say.


Say what you like however it had been working, and for the application 
it works, i dont think you get what its trying to do but anyway , im 
faking a url with session id's and ecrypted keys and sending the 
matches to the get request of that file so its hidden.




One thing to note is well 5.1RC4 has been available in Oct:
  http://downloads.php.net/ilia/




Thats not available from the main site downloads. I also forgot to 
meantion i had downloaded the latest from php snaps and still the same 
problem, so obviouslly it has been overlooked.



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