[PHP] Here Document function AWOL

2001-03-30 Thread Kristofer Widholm

Dear PHPers. I have tried to get the "Here Document" functionality to 
work, all to no avail.

I am writing the following code:
$body = EOQ
Lots of HTML stuff here
Lines and Lines and lines of it.


all the way to
EOQ;

I get a parse error on the first line where I declare the variable. I 
have tried it in several different ways, such as
$body=
EOQ

But I get parser errors every time.

My PHP version is 4.0.2

Anyone know when Here Documents were first implemented in PHP 
(version number)? Do I need to set GPC or magic-quotes to a certain 
value at runtime for this to work?

I could not find "here document" even MENTIONED on the entire php 
site. Nor could I find it in the mailing list archives. I did find 
out about it at the Zend tutorial on strings, and have seen it in a 
script at px.sklar.

Kristofer
-- 
______

Kristofer Widholm
Web Pharmacy
[EMAIL PROTECTED]
191 Grand Street, Brooklyn  NY  11211
718.599.4893
__

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




[PHP] Strange Error Reporting

2001-03-25 Thread Kristofer Widholm

Anyone know why I get this warning?

Warning: Bad escape sequence: \. in validate.inc.php on line 142

CODE:
Line 142: if (!eregi("index\.php",$PHP_SELF)) {
blah blah blah;
}

I didn't know there was any other escape sequence possible in RegEx!

I have error reporting set to
error_reporting(32+16+8+4+2+1);

and that's pretty picky error reporting. Still, I don't get what's wrong.

K
-- 
__

Kristofer Widholm
Web Pharmacy
[EMAIL PROTECTED]
191 Grand Street, Brooklyn  NY  11211
718.599.4893
__

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




[PHP] Re: Text fading with PHP?

2001-03-24 Thread Kristofer Widholm

Here's what you wrote, 01.03.24:

Hi

Is it possible to do text fading with PHP.  For instance, I want to one line
of text fade in, have another line fade in later, and a third line after
that.  Then all three lines will fade out at the same time and start over
with three different lines.  Is this possible with php?

Thanks

Jamie

No, due to some browsers waiting for all a complete document object 
before outputting text. Even with browsers that will parse and 
display a partial feed, you really can't achieve a smooth effect due 
to network latency. The best thing to do is to work with JavaScript 
and CSS. Look into the setTimeout() function in JavaScript and use it 
to step through different color values for your text using CSS.

Or, just use an animated gif.

K
-- 
__

Kristofer Widholm
Web Pharmacy
[EMAIL PROTECTED]
191 Grand Street, Brooklyn  NY  11211
718.599.4893
__

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




[PHP] Still can't talk to the Oracle

2001-02-13 Thread Kristofer Widholm

I'm setting up a back end production system for a television show, 
and have been given space on a development server with PHP 4 and 
Oracle support compiled in (but not the OCI libraries). The Oracle 
admin have given me my user name (let's say ora_user), a TNS name 
(tns_name), and a password (ora_pass).

So I write code as follows...

if ($conn=ora_logon("ora_user@tns_name","ora_pass")) {
echo "SUCCESS ! Connected to database\n";
} else {
echo "Failed :-( Could not connect to database\n";
echo ora_errorcode($conn).": ".ora_error($conn)."BR";
}

In response to this code, I get the following error:
ORA-12154 "Supplied argument is not a valid Oracle-Connection/Cursor 
resource in "

 From reading php.net documentation on ora_logon, it seemed that maybe 
the ORACLE_HOME environment variable simply hadn't been set.

I had the sys admins set it.

And I still get the error.

Any ideas from an experienced PHP/Oracle developer?

Kristofer

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




[PHP] Re: Cookie with Netscape

2001-01-30 Thread Kristofer Widholm

At 11.08 -0800 01-01-29, Eugene Yi (InfoSpace Inc) poked the keyboard 
as follows:
I set up a cookie using the following command and it works fine under IE but
not in Netscape.  Am I doing something wrong?

setcookie("mycookie[1]",$domain,"","/","mydomain.com");

Please help me.  Thanks much in advance.

Can't promise that this will solve it, but here are a couple pointers:

If $domain is a string, it might help to put the variable within quotes too.

As pointed out previously, you should replace your expiration time 
("") with an integer (0).

The domain at the end, according to spec, should start either with 
www or with a period (.mydomain.com).

See if that helps.

Kristofer
-- 
______

Kristofer Widholm
Web Pharmacy
[EMAIL PROTECTED]
191 Grand Street, Brooklyn  NY  11211
718.599.4893
__

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




Re: [PHP] Editor

2001-01-30 Thread Kristofer Widholm

At 08.02 + 01-01-30, Philip Olson poked the keyboard as follows:
http://marc.theaimsgroup.com/?l=php-generalr=1w=2q=bs=editor


mac
- bbedit

On the Mac there is also a wonderful new editor just ported over from 
BeOS called Pepper. It's really elegant, and incredibly customizable. 
It has PHP syntax coloring too.

Also, BBEdit only includes PHP syntax coloring in version 6.0 and above.

Kristofer
-- 
__

Kristofer Widholm
Web Pharmacy
[EMAIL PROTECTED]
191 Grand Street, Brooklyn  NY  11211
718.599.4893
__

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




Re: [PHP] Invoke PHP script from onLoad handler?

2001-01-29 Thread Kristofer Widholm

Here's what you wrote, 01-01-27:

OK, I've gone back through the archives and now understand the situation
with client- and server-side. I just wasn't thinking it through.

Spawning a window to let PHP query the db and somehow passing returned
values back to the parent window is something I could do, I suppose, but
it seems that what I and the other zillion people who keep asking the
same question need is a way to get to our databases using a client-side
technology like Javascript.

If it's not an enormous amount of data the user will be working with, 
and they're just reading it and not inputting new values (a set 
number of options, etc.), you could just load all the data into 
JavaScript arrays at the initial load. Whenever a part of any form or 
window is changed, the displayed data would be changed as well via 
JavaScript, without the need for any database query.

Kristofer
-- 
__

Kristofer Widholm
Web Pharmacy
[EMAIL PROTECTED]
191 Grand Street, Brooklyn  NY  11211
718.599.4893
__

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




[PHP] Re: Using PHP to do centralized site authentication

2001-01-27 Thread Kristofer Widholm

I'm trying to do something in PHP4.0.4p1 that in the past I've done in
mod_perl, but appears to be more difficult.  Basically I have some PHP
code that does access checks against a DB to see if that user has access
to the requested URL.  I'm using mod_layout to call the PHP script so I
can wrap static html pages, CGI's, and not just PHP pages.

I may be misunderstanding your question, but it seems to me if you 
use the HTTP_AUTH mechanism built into PHP you can authenticate 
against a database or whatever you need in PHP before any page output 
is generated whatsoever. If the user is not authenticated, PHP just 
generates a standard 302, just as if you were using basic auth under 
Apache.  If you structure your script logic correctly, there should 
be no output being processed until authentication has been made.

My apologies if I've totally misunderstood your situation.

Kristofer
-- 
__

Kristofer Widholm
Web Pharmacy
[EMAIL PROTECTED]
191 Grand Street, Brooklyn  NY  11211
718.599.4893
__

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




[PHP] PHP and Oracle resources

2001-01-27 Thread Kristofer Widholm

Well, I've been given the joyous task of implementing the DaveTV 
project at CBS via PHP, using Oracle as a database.

I've never used Oracle before.

Looking at the PHP functions for Oracle, and having heard about it in 
the past, it seems like quite a different approach than any SQL 
database I've ever used.  I still don't get the whole point of cursor 
objects, etc. :-)

It would all be pretty hilarious if it weren't so real, and with a 
big fat deadline looming smack for the end of February.

To get to the point: Anyone have any good PHP  Oracle tutorials, 
resources, books, etc, to point me to?  EVERYTHING I see is MySQL, 
MySQL, MySQL, and all I get for Oracle are lists of unexplained PHP 
function calls.

Just point me in the right direction. I can walk there myself.

Thanks for the help.

Kristofer
-- 
__

Kristofer Widholm
Web Pharmacy
[EMAIL PROTECTED]
191 Grand Street, Brooklyn  NY  11211
718.599.4893
__

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




RE: [PHP] Search Engines and PHP

2001-01-23 Thread Kristofer Widholm

At 13.33 +0100 01-01-23, Sander Pilon poked the keyboard as follows:
  
  If you want to be totally searchengine-safe, do not use variables on the
  url, do not rely on cookies and do not rely on POST variables
  for the pages
  you want to have the searchengine spider.

  How the heck do you build a dynamic site without URL variables,
  cookies, or POST variables?

  Kristofer

One way would be to use the url path.

Http://script.php/these/are/variables/passed/to/php

You fool the searchengine, it thinks 'script.php' is a directory and its
getting a file called 'php', but actually you're calling 'script.php' with
'/these/are/variables/passed/to/php' as parameters.

I'm assuming that the tradeoff is the loss of having your variables 
pre-populated in your scripts and that you have to parse the URL for 
them. While it's probably easy enough to write my own, does anyone 
have -- ready made -- a robust and versatile function for populating 
variables from a URL.

My impulse is to go with this:

list($var1,$var2,$var3)=explode("/","$PHP_SELF");

Anyone one have a better idea?

A difference to note, it strikes me, is that using this method, it is 
no longer arbitrary in which order the variables are stacked in the 
URL. http://domain/script.php/value1/value2/value3 would be a 
different page from http://domain/script.php/value3/value1/value2, 
whereas using variable declarations in the URL like so 
http://domain/script.php?value2=foovalue3=barvalue1=barfly means 
you can put them in any order you like.

Kristofer
-- 
______

Kristofer Widholm
Web Pharmacy
[EMAIL PROTECTED]
191 Grand Street, Brooklyn  NY  11211
718.599.4893
__

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




[PHP] RE: Authenticating across sites/servers

2001-01-23 Thread Kristofer Widholm
   also 
contain the users

session key, so it knows
which 
user should event-
ually 
be given access.

Server A redirects user to Server B,
sending the original authorization
key along with the user (in a
cookie, or session ID)

Server 
B sees user with
auth 
key, checks to see if
there 
is an OK registered
in 
it's database corres-

ponding to that auth key.

Here 
we can also add time-

sensitive verification, as
well 
as a check to see

whether the original auth-
orized 
user's request is
still 
coming from the same
IP 
(subject to proxy server

restrictions if user comes
from 
large ISP). I.E.
if( 
auth OK  record of
auth 
 same IP  within
last 
10 minutes) then
give 
user a page which

verifies that the user
has 
the key, that server
B has 
a key, that it

corresponds to a recent
record 
of authorization
in 
it's database, that's
it's 
coming from the
same 
IP as the request for
auth 
came from from
server 
A, and then gives
the 
user the data.
-- 
______

Kristofer Widholm
Web Pharmacy
[EMAIL PROTECTED]
191 Grand Street, Brooklyn  NY  11211
718.599.4893
__

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




[PHP] Re: [PHP-DEV] cookies and sessions security

2001-01-15 Thread Kristofer Widholm

Poor security: log in with a form or basic authentication; set cookie on
client with username/password combo (vulnerable to network sniffers,
anybody with access to browser's cookie file)
Decent security: log in with form or basic authentication; set cookie with
session id number and store user information in session database (or
session file or in session memory or however your sessions are handled...)
(vulnerable to sniffers)
Good security: perform auth over a secure connection, set cookie with
session id number and store user information (including ip address) in
session database (and check ip address for a match before allowing any
activity with the session)... (vulnerable to somebody copying a sniffed
session id and spoofing the ip address to trick the remote site)
Very good: keep the thing on a secure connection all the time, set a
session id cookie and keep all user info (possibly including remote ip) in
the server's session db... (vulnerable to nothing I can think of at the
moment...)

There are probably more things you could do I haven't thought of... but
this oughta be a decent start ;)

--Toby

Wow, I never thought of using the remote IP!  Thanks for the tip. I 
am going to use it today for an authentication system I'm building.

Kristofer
-- 
__

Kristofer Widholm
Web Pharmacy
[EMAIL PROTECTED]
191 Grand Street, Brooklyn  NY  11211
718.599.4893
__

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




Re: [PHP] Re: [PHP-DEV] cookies and sessions security

2001-01-15 Thread Kristofer Widholm

At 14.54 -0500 01-01-15, Tim Zickus poked the keyboard as follows:
   Wow, I never thought of using the remote IP!  Thanks for the tip. I
  am going to use it today for an authentication system I'm building.

Please note that remote IP is NOT reliable.  For clients behind the proxies
 gateways of large ISP's (AOL is the prime example) you can see the remote
address bounce around from number to number, even within the same session,
depending on which path the data takes.

Ach, oy vey! Then, having looked at AOL's info, it seems to me that 
perhaps one could build a function or class that could evaluate 
against a known list of alternate proxies. So, if the request came 
from 152.163.197, it would recognize that as an AOL proxy and just 
code the current proxy as "AOL" or something. Each subsequent request 
(from 152.163.* etc.) would go through the same filter.

Obviously, this means that the system could be vulnerable to being 
compromised by someone working through a large ISP such as AOL, but I 
think it's unlikely that people with the expertise to sniff cookies 
and such would be using AOL. And anyway, the system would still be 
more secure than if I weren't using IP verification at all.

Does anyone one know of a class or function that's been already built 
to do this?

Kristofer
-- 
__

Kristofer Widholm
Web Pharmacy
[EMAIL PROTECTED]
191 Grand Street, Brooklyn  NY  11211
718.599.4893
__

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




[PHP] Re: Searching a MySQL database?

2001-01-14 Thread Kristofer Widholm

I remember seeing someone post something like this:

$sql = " SELECT * FROM table_name
 WHERE towns LIKE \"$town\" ";

so if the search word is not EXACTLY like a row in the database, it may
return results to partial words.

I think you mean
$sql = "SELECT * FROM table_name WHERE towns LIKE \"%$town%\" ";

The % is more fuzzy. Look it up in the MySQL manual for more details 
on %. http://www.mysql.com/doc/

Kristofer
-- 
______

Kristofer Widholm
Web Pharmacy
[EMAIL PROTECTED]
191 Grand Street, Brooklyn  NY  11211
718.599.4893
__

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




[PHP] Re-engineering print()

2001-01-10 Thread Kristofer Widholm

Hi, I'm involved in a conundrum that is a little difficult to explain 
with plain English. Perhaps some PHP code will help you understand 
what I am attempting:

#Option 1: code I wish worked
$s = include("phpcode.php");

#Option 2: also code I wish worked
$s = sprintf("%s", include('template.php'));

Basically, I'm wondering if there is a way to redirect print and echo 
output from PHP to a variable instead of directly to a browser or 
file stream. What I'm trying to do is create code that can generate 
an HTML page to a variable that I can manipulate and then later store 
in a database.

Obviously, the "real" way to do this is to not use print() statements 
at all, but simply build a variable as follows:
$output .= "html yadda yadda yadda";
$output .= sprintf("More html and function output %s", function());

until the $output contains the entire file.

The reason I don't want to do this is that it will require rewriting 
all my PHP file templates.

Also, I'm simply obsessed with the problem now. I even went as far as 
using eval() on the reading of an fopen(template.php) of the PHP 
template, but even then I couldn't assign the output to a variable.

Anyone want to kill themselves trying? My head hurts.

Sincerely,
Kristofer
-- 
  http://www.brokenhill.net
~/
"The only real ideas are the ideas of the shipwrecked"
--Ortega y Gassett

~~~/~~

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




[PHP] Re-engineering print()

2001-01-10 Thread Kristofer Widholm

Hi, I'm involved in a conundrum that is a little difficult to explain 
with plain English. Perhaps some PHP code will help you understand 
what I am attempting:

#Option 1: code I wish worked
$s = include("phpcode.php");

#Option 2: also code I wish worked
$s = sprintf("%s", include('template.php'));

Basically, I'm wondering if there is a way to redirect print and echo 
output from PHP to a variable instead of directly to a browser or 
file stream. What I'm trying to do is create code that can generate 
an HTML page to a variable that I can manipulate and then later store 
in a database.

Obviously, the "real" way to do this is to not use print() statements 
at all, but simply build a variable as follows:
$output .= "html yadda yadda yadda";
$output .= sprintf("More html and function output %s", function());

until the $output contains the entire file.

The reason I don't want to do this is that it will require rewriting 
all my PHP file templates.

Also, I'm simply obsessed with the problem now. I even went as far as 
using eval() on the reading of an fopen(template.php) of the PHP 
template, but even then I couldn't assign the output to a variable.

Anyone want to kill themselves trying? My head hurts.

Sincerely,
Kristofer
-- 
  http://www.brokenhill.net
~/
"The only real ideas are the ideas of the shipwrecked"
--Ortega y Gassett

~~~/~~

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




Re: [PHP] Re-engineering print() - PHP 4 required

2001-01-10 Thread Kristofer Widholm

Here's what you wrote, 01-01-10:

Try this:

function my_eval($code) {
ob_start();
eval($code);
$retval = ob_get_contents();
ob_end_clean();
return $retval;
}

$str = my_eval("echo 2+2;");
echo $str;

Mr. Lerdorf, Mr. McClahahan, Mr. Butzon et al,

Thank you for your replies. It appears I'm going to have to see about 
having my server upgraded to PHP 4 in order to solve the problem, as 
PHP 3 does not support ob_*().

If anyone else is paying attention to this thread, please be advised 
that ob_ functions require PHP 4.

Thanks to all who have helped.

Sincerely,
Kristofer

-- 
  http://www.brokenhill.net
~/
"The only real ideas are the ideas of the shipwrecked"
--Ortega y Gassett

~~~/~~

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