Re: [PHP] session vars and frames

2002-07-01 Thread Richard Lynch

 I'm registering if people are logged in. The login page is situated in
>> the
 mainFrame.
 Now in my leftFrame I want to put the status (i.e. "you are logged in as
 .")
 
 When people are succesfully logged in I register their name as
 session_register('session_loginname');
 I then refresh the leftFrame.
 In the page to be displayed in the leftFrame  I put:
 

You also need to do:

session_start();

in this leftFrame page (URL)...

Otherwise, the leftFrame page (URL) has no idea that you are using sessions.

 >>> {
 echo "you are not a member";
 }
 else
 {
 echo "login: $session_loginname";
 }
 ?>

-- 
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: Beginner Sessions Question

2002-07-01 Thread Richard Lynch

>1.  I know that you initially begin the session with the session_start() 
>function.  Is this function required on all pages in order for the session 
>variables to remain globalized?

Yes -- on all pages that intend to use sessions.

If you have a page "in between" that has no use for session data, you can
(probably) not do session_start() unless you need the variable/functions to
pass the Session ID around as part of the URL if you don't like/trust the
Cookies to maintain user identification.

Not 100% sure about it if you are using URLs to pass session ID...  I mostly
figure anybody too paranoid to use Cookies is a lost cause anyway :-) :-)
:-)

>2.  If you have a "process login" page, which the user is sent to after 
>submitting the login information, is this page ideal to hold the 
>session_register() functions to define global variables and their values?

Probably...

It may be more natural to just session_register() variables as you go, but
if there are some high-level global variables, yeah, that's a good place to
put them.

>3.  Would this piece of code be good to hold the preferences of a user that 
>has just logged in?

Yes, but...  :-)


>
>session_start();
>$link = mysql_connect("localhost", "user", "pass")
> or die("Could not connect to database.");
>$db = mysql_db_select("users", $link)
> or die("Could not select database.");
>
>$query = "SELECT user, pass FROM users WHERE user='$user' AND pass='$pass' 
>LIMIT 1";
>$result = mysql_query($query, $link)
> or die("Query was not successful.  " . mysql_error());

Don't ever spew mysql_error() to the web browser.  Reveals too much to
hackers.

Something like:

$result = mysql_query($query, $line) or error_log(mysql_error());
if (!$result){
  die("Query was not successful");
}

And, really, $result is about a generic a variable name as $i

How about using $user_info or even $user_info_result?

Yes, I know every example and every PHP book on the planet uses $result. 
That doesn't make it right :-)

>if(mysql_num_rows($result) < 1) {
> "User not found.  Please try again.";

You need to echo that or something more than just have it sitting there...

Probably okay syntax-wise, but not what you intended. :-)

>} else {
> $query = "SELECT * FROM users WHERE user='$user' AND pass='$pass' LIMIT 1";

SELECT * is bad.

Figure out which columns you need, and ask for them by name.

> $result = mysql($query, $link)
>  or die("Query was not successful.  " . mysql_error());
> while($row = mysql_fetch_array($result)) {
>  $name = $row['name'];
>  $colorpref = $row['colorpref'];
>  $fontpref = $row['fontpref'];
>  $sizepref = $row['sizepref'];
> }
> session_register("UserName"); $UserName = $name;
> session_register("Color"); $Color = $colorpref;
> session_register("Font"); $Font = $fontpref;
> session_register("Size"); $Size = $sizepref;
>}

Problem:
If it's my first time here, and I haven't selected any color/font/size
preferences, your code may or may not "break"...  It's hard to say without
knowing how/when/what you initialize by default in the SQL, but watch out
for it.

In particular, if you are not going to die() on the "num_rows(...) < 1"
above...

>
>?>
>
>I know it's a lengthy example, but I wrote it, and want to know whether or 
>not that would work to load user preferences into the variables UserName, 
>Color, Font and Size?

I personally would do the session_register() before the while() loop, and
then just one (1) assignment for each setting.  Why assign to $name, and
then $UserName when you can just use $UserName?

Actually, I'd have the session_register() stuff 'way at the top of the page,
so I know what's "global" on this whole page.  Feels "cleaner" to me.  This
is a religious issue. :-)

Also -- Since you are only getting one row, why the while() loop?

Would it not make it more clear that your code expects one, and only one,
row if you used no while() loop and did:

list($UserName, $Color, $Font, $Size) = mysql_fetch_row($result, 0);

Or use the mysql_fetch_array() and four assignments if you like that better,
but get rid of the loop that will never, ever, really be a loop.

And in the end, there can be only one.

If you are enforcing unique usernames in the SQL and in other parts of your
application, shouldn't your PHP code reflect that business logic, and be
distinct from a while loop that could potentially spew out 100 records?  I
think it should.  But maybe I'm just being too preachy :-)

>That about does it for this installment of PHP Session Questions.  Please 
>reply directly since I'm on the digest!

Note that some of these comments are strictly on "style" and are arguable. 
I've tried to note them as such or frame them as possibilities when that was
the case.

I suspect other posters will comment on my comments and explain how "wrong"
I am on those parts. :-)

-- 
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] pop-up windows

2002-07-01 Thread Richard Lynch

In the old days, Rasmus would answer with something like:

http://php.net/FAQ.php#4.17

That was back when the whole FAQ could fit in the head of a single person...
:-)
[Well, a single person as smart as Rasmus, anyway... :-)]

This meta-thread about what to do about posters who obviously didn't do
their homework is just as endemic to the system as the original problem.

"The poor will always be with you"

I truly believe that the best solution is to simply point them to the URL
they should have found in the first place, maybe politely suggest they try
the search engine first next time, and leave it at that.

Being abusive is not going to make them want to improve themselves, really. 
Who gets the good results -- The sports coach who yells and screams at new,
untrained players for stupid mistakes, or the one who politely informs them
of their error, and sets them on the true path?

Now if you got a poster who *CONTINUES* in their wayward behaviour, an
off-list explanation of their error is a Good Idea (tm). :-)

And, you'll never get the volume of a General list for something as popular
as PHP to significantly decrease no matter how you try to hit users over the
head with "Do your homework"  There have already been more meta-posts about
FAQs than FAQs, and that's just silly.  [Which is why I'm making another
one, of course :-)]

Not saying that making it easy to find the right way to search isn't a Good
Idea (tm) but extremes like a daily post to tell people that is just "too
much" and won't help.


Disclaimer:

Once upon a time, a long time ago, as a brand-new user, I read the FAQ.  A
year went by.  I asked question # 4.17.  Why?  Well, when I read the FAQ, I
didn't even understand the QUESTION, much less the answer to #4.17. :-)

A fellow named Rasmus was kind enough to just reply:

http://php.net/FAQ.php#4.17

And you know what?  About a year after that, I figured out (Hey, I'm slow,
okay?) that this Rasmus guy (and that Zeev guy and that Andi guy) were the
actual *DEVELOPERS* of PHP, and I figured they could better spend his
(their) time fixing PHP for me, instead of answering questions with:
http://php.net/FAQ.php#4.17


So, you know what I did?  I started answering for him.

Hey, I even answered questions I didn't even understand.  No, really.  There
was this one Oracle question that kept popping up with the same error
message, and the answer (not yet in the FAQ at that time) was
SetEnv("ORACLE_HOME=/home/oracle");
[And that's not even the correct answer any more, but it was then.]

I didn't really know what SetEnv was, and I hadn't actually touched Oracle
(well, okay, Oracle 4.1.17 or somesuch when I worked this day job years and
years before, and they had this *horrible* command-line ASCII art interface
that you couldn't even create a database without answering a zillion
questions I didn't understand the question, much less know the answer to...)
 Anyway, for all practical purposes, I knew nothing about Oracle.
[Still don't, for all practical purpose, but I reckon I can get away with
"Just like chicken" if I ever need to use it.]

There were other questions about CGI and Module (whatever those are) and I
just memorized the FAQ answers and posted away.  I think I did that pretty
solid for, oh, three, maybe four years or so... :-)

Next thing you know, I was being hailed as PHP expert (and eventually became
one, I guess...).

'Course, I also got abusive emails from (eg) Oracle users after I told them
(in response to direct-email followup questions) that I had no idea how to
work Oracle and had never even seen it, and they seemed to think I was
deliberately lying to them and taunting them, but that's another story...
:-)

Anyway, my point is this -- Abusive answers don't help, no matter how
frustrated you are.  If you're that frustrated, let somebody else answer the
FAQ, or just let the guy flounder for awhile.  They'll either get answered
by somebody else, or the poster will get off their duff and start digging. 
Either way, just hit delete.

Just my take as a former (and maybe once again) "regular"   You'll have to
use my old email addresses to dig out my old posts if you wanna figure out
just how "regular" I was, back in the day...
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

And a few more I reckon I've forgotten, but that's okay :-)

I think Stas even had this nifty interface on the Zend site for a while
tracking post frequency by email.  I don't think I ever was more vociferous
than Rasmus, but it was close sometimes :-)

-- 
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: Canadian PHP Freelancer Rates

2002-07-01 Thread Richard Lynch

>Hi,
>
>I was hoping that folks from the Canadian PHP community could offer me some
>direction with deterring going rates for freelance PHP developers. All of
>the material that I have found during my research points to US rates which
>average at around $92 US an hour (see the American Institute of Graphic Arts
>white paper "Aquent Survey of Design Salaries 2002" at
>http://www.aquent.com/whitepapers/).

Is that before dot-bomb and 9/11 or after? :-^

It's sure more than I ever made free-lancing...

But then I've stopped taking any boring jobs.  No, I won't do another
shopping cart.

And the starving musicians I usually work for think $92 is a lot of money. 
Not $92 per hour, just plain old $92. :-)

Oh well.  I like what I do, at least.

-- 
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: PHP affecting PDF plug-in....?

2002-07-01 Thread Richard Lynch

>All...
>
>I have a PDF plug-in problem...
>
>Now before you say anything the problem doesnt exesi when I remove PHP from 
>the equation...
>
>I have a script that generates a drop-down list of ID's basically...
>Clicking continue will pass the ID to a script which I use to get the 
>correct filename to display...
>
>ALSO, this only seems to happen on IE 5...
>
>This is what happens...
>
>1) login
>2) select option to display list...
>3) Select Item...
>4) Pass & display item
>5) select option to display list...
>6) Select Item...
>7) Pass & display item
>
>Now... at stage 7... is where it appears to go wrong... i.e. IE hangs
>
>The PDF file is being displayed via an , also note that if I remove 
>the  the flow is as normal...
>
>[ http://www.the-local-guide.com :: http://www.mcgarvie.net ]

I had a recent case where the header() functions I was using to mark my PDF
files as being out-dated (Expires:, Pragma, all that crap) were causing IE
5.5 to choke on PDF files.

Don't ask me why stupid IE was choking on the idea that a PDF file was maybe
dated, but it was.

Sigh.  Ask Bill.

Anyway, take a look at the *HEADERS* that are coming out under the two
different situations, and see what you see...

One way to see the headers is to do:

telnet the-local-guide.com 80
GET /index.php HTTP/1.0
Host: the-local-guide.com


[Hit "return" twice after that last line]
This is a crude way to "fake out" a web-server into thinking you're a
browser.  Won't do Cookies or authentication or anything fancy like that,
but it's a start.

Also, I dunno what an iframe is, but that sounds suspect.  I'm a Luddite.  I
don't use HTML that doesn't work reliably on 3.0 browsers.

No DHTML/layers, no CSS -- I've seen too many broken CSS sites to believe in
it.

Show me a CSS site, and I'll show you unreadable text and INPUT boxes I
can't read what the hell I'm typing on my Mac IE 4.01 browser.

-- 
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] Keeping "Secrets" in PHP Files

2002-07-01 Thread Richard Lynch

>try this for now.
>
>http://pobs.mywalhalla.net/
>
>depending on how fancy your code is it may not work. Or you'll only have 
>to change a few little things.
>
>basically what it does is :
>
>for($bob=1; $bob<10; $bob++){
>echo $bob;
>$sam=$bob;
>}
>
>Converts above to something like
>
>for($edghr354dfga=1; $edghr354dfga<10; $edghr354dfga++){ echo 
>$edghr354dfga;$hsfgfsyrtae34dfgdfas=$edghr354dfga; }
>
>basically.

Sure hope they are not charging money for *THAT*...

And I don't see how it helps the "secrets" issue at all...

-- 
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] Keeping "Secrets" in PHP Files

2002-07-01 Thread Richard Lynch

>The hosting provider could probably implement a solution...  Alter the FTP
>configuration to automatically set the group permission to that of the web
>server when you transfer files.  You wouldn't need to be in the group.
>You're the owner and can modify your own files.  World Read access would be
>unnecessary.
>
>Thoughts?

So I write a PHP application to read your file, or just symlink a .phps file
to it.

Game over.

The "Group" is no more magical than the "User" as an access route.

If PHP can read it to use, PHP can read it for me to steal.

-- 
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] Keeping "Secrets" in PHP Files

2002-07-01 Thread Richard Lynch

>I've been thinking some more about the issue of keeping PHP
>source files secure in a shared hosting environment.  I've now
>convinced myself that there is simply no way to protect these
>files, even if safe_mode is turned on, as long as other users can
>have telnet (or ssh) access to the box.
>
>Here's my thinking ...
>
>First off, I am assuming that
> - we are discussing a Unix-variant
> environment (I don't know enough about
> Windows to comment)
> - the web server does NOT run as root

To be thorough, you should also rule out:



1. PHP *could* be run as a CGI via suExec as your own user, and thus only if
your own shell account was compromised would the file be readable.  (If your
own shell account is compromised you probably have bigger problems than just
the PHP-readable files...)  My host actually provides me with both "nobody"
Module and "realuser" CGI PHP installation, for example. 
(http://hostbaby.com --  I highly recommend them -- Apparently they had a
hard drive crash last week, but I didn't even notice anything until a cron
job ran this week that needed to read/write a file whose permissions didn't
quite get restored.)

So, if I *really* wanted a particular "secret" secure, I could run it as CGI
and keep all my files 400 (or 600 for data)  So far, I've used the CGI more
for the second stage of file upload (copy into web-tree *ONLY* after
security vetting has occurred) but I *COULD* run all the database pages
through CGI...  And with the minimal traffic I get, I probably should...  Oh
well.

[ASIDE]
Too bad I can't run the CGI one first, get a db connection, and then
"switch" to the Module one for the rest...  Oh, never mind, once you've
fired up the CGI, it ain't slower to run.
[/ASIDE]



2. I *think* Apache 2.0 *can* be made to run PHP as a Module in different
directories as different users...  At least, last I heard, that was on the
boards for "To Do" in Apache 2.0...  So, in theory, as I understand it,
there *could* be an ISP who was running Apache 2.0 Beta that was running
each users' PHP Module as that user, and your "secrets" files would not be
world-readable.



3. I'm reasonable certain fhttpd has the same feature as described in 2.



That said, some more caveats about file browsing:

I *THINK* you can bury your PHP file inside directories that are not readily
browsable by other shell accounts.  So long as the "foo.inc" file *is*
readable, the intervening directories don't have to be.  I *THINK*.  I got
bit by this once on one web-site, but I was mixing and matching a Module and
CGI usage (see 1.) and maybe was just confusing myself about which user was
actually 'acting' at a particular time.

>So unless I'm missing something, safe_mode provides no protection
>in a Unix environment where
> - the web server does not run as root
> - other users have telnet access to the box
>
>I hope wrong.  Can anyone find the hole in my reasoning?

Safe mode stops some of the most obvious routes of reading the files in
question -- It doesn't stop a determined reader from digging them out and
reading them.

As noted earlier -- If a real hacker *really* wants to break in, they will.

Usually, your task (and the ISP's) is to raise the bar high enough that the
frequency of successful attack is low enough, that you/they don't spend
your/their entire life restoring from un-hacked backups.

There are some high-end special cases where your task is far more
complicated than that, of course...

To that end, less-obvious file names and safe mode "weed out" some
percentage of the "wannabe hackers"

If truly secure "secrets" are needed, a shared environment is the wrong
answer...

The same shoe doesn't fit everybody.  I generally prefer systems where I
don't feel hamstrung every time I need to do something interesting with my
web-sites, and I'm willing to risk the (mostly public) data in my databases
being compromised by fellow clients of my ISP for that.

I'm also mostly on servers with starving musicians who have a hard enough
time getting their web-sites to work and getting gigs, much less time to
waste pawing through my files :-)

In one extreme case, the bulk of the data is editable by anybody on the
planet through a web-interface, so "securing" the username/password would be
almost pointless.  I still do it, through habit and to avoid mass
destruction by the unwashed masses, but...

Security is not an on/off switch.  It's a gradient in N dimensions, where
you have to balance usability, development time, risk, upper management
stupidity, and a host of minor variables to decide where your
software/hardware/solution "fits" into the spectrum.

You can't learn that in one day, or even in a week's seminar.  It's a place
where experience counts.

I'm not saying a one-week security seminar wouldn't be invaluable -- only
that the seminar has to be followed by a lot of real-world experience to be
really useful.

I've picked up (mostly against my will) enough knowledge about security to
know how truly ignorant I am

[PHP] Programmer's Browser

2002-07-01 Thread Richard Lynch

Any recommendations for a GPL (read: free) "Programmer's Browser" which will
allow me to surf "normally" but cache pages and their headers and let me
view the damn things?

"View Source" is fine as far as it goes, but it's only half the story...  I
want my headers.

-- 
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] Passing more than one variable with alink

2002-07-01 Thread Martin Towell

the syntax is name1=val1&name2=val2&name3=val3
the separator is "&"

-Original Message-
From: Peter Goggin [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 02, 2002 4:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Passing more than one variable with alink


I need to pass more than one variable with a link.

I cannot see the syntax listed anywhere.

I am using :
printf ("",$catitempage,$catrange);


Obviously the separators between the two variablesare incorrect.   i.e. I
have: ?catitempage=%s;?catrange=%s

Can anyone tell me what it should be or where I can find a reference to
these sort of syntax problems.


Regards

Peter Goggin


-- 
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] Passing more than one variable with alink

2002-07-01 Thread Sachin Keshavan

For the link to work correctly, only the first parameter should be seperated
by a ?, the remaining ones should be seperated by &.

For eg:
http://localhost.com/sample.php?firstparam=1&secondparam=XYZ

Hope this helps,
Sachin

-Original Message-
From: Peter Goggin [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 02, 2002 12:01 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Passing more than one variable with alink


I need to pass more than one variable with a link.

I cannot see the syntax listed anywhere.

I am using :
printf ("",$catitempage,$catrange);


Obviously the separators between the two variablesare incorrect.   i.e. I
have: ?catitempage=%s;?catrange=%s

Can anyone tell me what it should be or where I can find a reference to
these sort of syntax problems.


Regards

Peter Goggin


-- 
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] Passing more than one variable with alink

2002-07-01 Thread Peter Goggin

I need to pass more than one variable with a link.

I cannot see the syntax listed anywhere.

I am using :
printf ("",$catitempage,$catrange);


Obviously the separators between the two variablesare incorrect.   i.e. I
have: ?catitempage=%s;?catrange=%s

Can anyone tell me what it should be or where I can find a reference to
these sort of syntax problems.


Regards

Peter Goggin


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




Re: [PHP] Using the AS key word in SQL Queries

2002-07-01 Thread Analysis & Solutions

On Tue, Jul 02, 2002 at 11:08:13AM +0530, Sachin Keshavan wrote:
> 
> I am trying to execute the Query
> SELECT MAX(RECORDNO) AS MAXREC FROM BOOKS;
> 
> while($row = mysql_fetch_array($sql_result))
> {
>$bookID = $row['MAXREC'];
> }
> 
> This query fails. Am I doing any thing wrong here. 

Don't ask us.  Ask MySQL.  After running the query (I assume you ARE
running the query, via mysql_query(), right?) throw in an echo call to
mysql_error().  That'll tell you what went wrong:

http://www.php.net/manual/en/function.mysql-error.php

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

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




[PHP] Using the AS key word in SQL Queries

2002-07-01 Thread Sachin Keshavan

Hello all,

I am trying to execute the Query
SELECT MAX(RECORDNO) AS MAXREC FROM BOOKS;

I am trying to access the value like this
while($row = mysql_fetch_array($sql_result))
{
 $bookID = $row['MAXREC'];
}

This query fails. Am I doing any thing wrong here. 

Thanks,
Sachin.

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




Re: [PHP] Unable to restart httpd after upgrading PHP

2002-07-01 Thread Jason Wong

On Tuesday 02 July 2002 12:22, Robert Tan wrote:
> Hi There,
>
> I am running a Sun Cobalt RAQ4 server. The PHP version on it is 4.0.6.
> I received an error message when I restart httpd after upgrading PHP
> scripting engine on my cobalt server through the patch that cobalt
> provided to fixes some security issues that were found on prior
> releases of PHP for Sun Cobalt server appliance.

Sounds like you want the Cobalt mailing list!

> The error message is "Setting up Web Service: Syntax error on line 58
> of /etc/httpd/conf/httpd.conf:
> Cannot load /etc/httpd/modules/libphp4.so into server: libgd.so.1:
> cannot open shared object file: No such file or directory
> /usr/sbin/httpd"

libgd.so.1 is part of the GD library. Try upgrading _all_ the packages on your 
Cobalt.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
It was a JOKE!!  Get it??  I was receiving messages from DAVID LETTERMAN!!
YOW!!
*/


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




Re: RE: [PHP] Updated (appending) a file

2002-07-01 Thread Chris Earle

Thanks again man, you've been a ton of help.

I gotta get some sleep now!  Thanks again.

"Martin Towell" <[EMAIL PROTECTED]> wrote in message
6416776FCC55D511BC4E0090274EFEF508A58C@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A58C@EXCHANGE...
> Um - yeah - sorta
> depends if the script has write access to the directory too :)
> but try and see, I guess is the best option ...
>
> -Original Message-
> From: Chris Earle [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 02, 2002 4:14 PM
> To: [EMAIL PROTECTED]
> Subject: Re: RE: [PHP] Updated (appending) a file
>
>
> Permission denied
>
> Yep. Crap.  If I let PHP create the file (delete the files as they exist
> now), that will give it permission (because it will have made them),
right?
>
> Thanks a lot for all the help.
>
>
> "Martin Towell" <[EMAIL PROTECTED]> wrote in message
> 6416776FCC55D511BC4E0090274EFEF508A58B@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A58B@EXCHANGE...
> > This should work
> >
> > error_reporting(E_ALL);
> >
> > but be prepared for all dem warnings !  :)
> >
> >
> >
> > BTW: I get an undeliverable mail to your email address when I "reply to
> all"
> > :(
> >
> > -Original Message-
> > From: Chris Earle [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, July 02, 2002 4:04 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: RE: [PHP] Updated (appending) a file
> >
> >
> > The server has error reporting turned off (can I change this even though
> I'm
> > not there?)...
> >
> > I cannot do it with the file in my base folder either.
> >
> > "Martin Towell" <[EMAIL PROTECTED]> wrote in message
> > 6416776FCC55D511BC4E0090274EFEF508A58A@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A58A@EXCHANGE...
> > > maybe a permissions thing?
> > >
> > > do you get any errors back? if so, what error is it?
> > >
> > > try appending to a file in the same directory as index.php and see how
> > that
> > > goes.
> > >
> > > -Original Message-
> > > From: Chris Earle [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, July 02, 2002 3:54 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: RE: RE: [PHP] Updated (appending) a file
> > >
> > > More to the point: if that relative path doesn't work, and the path is
> > right
> > > and the file does exist, what does that mean?
> > >
> > > -- if the php file is: mydomain.com/index.php
> > > -- and the data file is: mydomain.com/files/Names.txt
> > > --
> > > -- then the relative path is not "\\files\\Names.txt" , it's
> > > -- "files\\Names.txt"
> > > --
> > > -- HTH
> > > -- Martin



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




[PHP] Unable to restart httpd after upgrading PHP

2002-07-01 Thread Robert Tan

Hi There,

I am running a Sun Cobalt RAQ4 server. The PHP version on it is 4.0.6. 
I received an error message when I restart httpd after upgrading PHP 
scripting engine on my cobalt server through the patch that cobalt 
provided to fixes some security issues that were found on prior 
releases of PHP for Sun Cobalt server appliance.

The error message is "Setting up Web Service: Syntax error on line 58 
of /etc/httpd/conf/httpd.conf:
Cannot load /etc/httpd/modules/libphp4.so into server: libgd.so.1: 
cannot open shared object file: No such file or directory
/usr/sbin/httpd"

Appreciate your help.

Thank you.

Regards,
Robert


*E-MAIL DISCLAIMER**
This document should only be read by those persons to whom it is 
addressed and is not intended to be relied upon by any person without 
subsequent written confirmation of its contents. Accordingly, 
iASPire.Net Pte Ltd disclaim all responsibility and accept no 
<\28>liability including in negligence<\29> for the consequences of any 
person acting, or refraining from acting, on such information prior to 
the receipt by those persons of subsequent written confirmation. If you 
have received this e-mail message in error, please notify us 
immediately by telephone <\28>65-5801900<\29>. Please also destroy and 
delete the message from your computer. Any form of reproduction, 
dissemination, copying, disclosure, modification, distribution and/or 
publication of this e-mail message is strictly prohibited.



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




RE: RE: [PHP] Updated (appending) a file

2002-07-01 Thread Martin Towell

Um - yeah - sorta
depends if the script has write access to the directory too :)
but try and see, I guess is the best option ...

-Original Message-
From: Chris Earle [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 02, 2002 4:14 PM
To: [EMAIL PROTECTED]
Subject: Re: RE: [PHP] Updated (appending) a file


Permission denied

Yep. Crap.  If I let PHP create the file (delete the files as they exist
now), that will give it permission (because it will have made them), right?

Thanks a lot for all the help.


"Martin Towell" <[EMAIL PROTECTED]> wrote in message
6416776FCC55D511BC4E0090274EFEF508A58B@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A58B@EXCHANGE...
> This should work
>
> error_reporting(E_ALL);
>
> but be prepared for all dem warnings !  :)
>
>
>
> BTW: I get an undeliverable mail to your email address when I "reply to
all"
> :(
>
> -Original Message-
> From: Chris Earle [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 02, 2002 4:04 PM
> To: [EMAIL PROTECTED]
> Subject: Re: RE: [PHP] Updated (appending) a file
>
>
> The server has error reporting turned off (can I change this even though
I'm
> not there?)...
>
> I cannot do it with the file in my base folder either.
>
> "Martin Towell" <[EMAIL PROTECTED]> wrote in message
> 6416776FCC55D511BC4E0090274EFEF508A58A@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A58A@EXCHANGE...
> > maybe a permissions thing?
> >
> > do you get any errors back? if so, what error is it?
> >
> > try appending to a file in the same directory as index.php and see how
> that
> > goes.
> >
> > -Original Message-
> > From: Chris Earle [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, July 02, 2002 3:54 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: RE: [PHP] Updated (appending) a file
> >
> > More to the point: if that relative path doesn't work, and the path is
> right
> > and the file does exist, what does that mean?
> >
> > -- if the php file is: mydomain.com/index.php
> > -- and the data file is: mydomain.com/files/Names.txt
> > --
> > -- then the relative path is not "\\files\\Names.txt" , it's
> > -- "files\\Names.txt"
> > --
> > -- HTH
> > -- Martin

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




Re: RE: [PHP] Updated (appending) a file

2002-07-01 Thread Chris Earle

Permission denied

Yep. Crap.  If I let PHP create the file (delete the files as they exist
now), that will give it permission (because it will have made them), right?

Thanks a lot for all the help.


"Martin Towell" <[EMAIL PROTECTED]> wrote in message
6416776FCC55D511BC4E0090274EFEF508A58B@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A58B@EXCHANGE...
> This should work
>
> error_reporting(E_ALL);
>
> but be prepared for all dem warnings !  :)
>
>
>
> BTW: I get an undeliverable mail to your email address when I "reply to
all"
> :(
>
> -Original Message-
> From: Chris Earle [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 02, 2002 4:04 PM
> To: [EMAIL PROTECTED]
> Subject: Re: RE: [PHP] Updated (appending) a file
>
>
> The server has error reporting turned off (can I change this even though
I'm
> not there?)...
>
> I cannot do it with the file in my base folder either.
>
> "Martin Towell" <[EMAIL PROTECTED]> wrote in message
> 6416776FCC55D511BC4E0090274EFEF508A58A@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A58A@EXCHANGE...
> > maybe a permissions thing?
> >
> > do you get any errors back? if so, what error is it?
> >
> > try appending to a file in the same directory as index.php and see how
> that
> > goes.
> >
> > -Original Message-
> > From: Chris Earle [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, July 02, 2002 3:54 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: RE: [PHP] Updated (appending) a file
> >
> > More to the point: if that relative path doesn't work, and the path is
> right
> > and the file does exist, what does that mean?
> >
> > -- if the php file is: mydomain.com/index.php
> > -- and the data file is: mydomain.com/files/Names.txt
> > --
> > -- then the relative path is not "\\files\\Names.txt" , it's
> > -- "files\\Names.txt"
> > --
> > -- HTH
> > -- Martin
>
>
>
> --
> 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: RE: [PHP] Updated (appending) a file

2002-07-01 Thread Martin Towell

This should work

error_reporting(E_ALL);

but be prepared for all dem warnings !  :)



BTW: I get an undeliverable mail to your email address when I "reply to all"
:(

-Original Message-
From: Chris Earle [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 02, 2002 4:04 PM
To: [EMAIL PROTECTED]
Subject: Re: RE: [PHP] Updated (appending) a file


The server has error reporting turned off (can I change this even though I'm
not there?)...

I cannot do it with the file in my base folder either.

"Martin Towell" <[EMAIL PROTECTED]> wrote in message
6416776FCC55D511BC4E0090274EFEF508A58A@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A58A@EXCHANGE...
> maybe a permissions thing?
>
> do you get any errors back? if so, what error is it?
>
> try appending to a file in the same directory as index.php and see how
that
> goes.
>
> -Original Message-
> From: Chris Earle [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 02, 2002 3:54 PM
> To: [EMAIL PROTECTED]
> Subject: RE: RE: [PHP] Updated (appending) a file
>
> More to the point: if that relative path doesn't work, and the path is
right
> and the file does exist, what does that mean?
>
> -- if the php file is: mydomain.com/index.php
> -- and the data file is: mydomain.com/files/Names.txt
> --
> -- then the relative path is not "\\files\\Names.txt" , it's
> -- "files\\Names.txt"
> --
> -- HTH
> -- Martin



-- 
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: RE: [PHP] Updated (appending) a file

2002-07-01 Thread Chris Earle

display_errors = On;  according to phpinfo(); All other error reporting is
off though.  But nothing is being displayed.

"Chris Earle" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> The server has error reporting turned off (can I change this even though
I'm
> not there?)...
>
> I cannot do it with the file in my base folder either.
>
> "Martin Towell" <[EMAIL PROTECTED]> wrote in message
> 6416776FCC55D511BC4E0090274EFEF508A58A@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A58A@EXCHANGE...
> > maybe a permissions thing?
> >
> > do you get any errors back? if so, what error is it?
> >
> > try appending to a file in the same directory as index.php and see how
> that
> > goes.
> >
> > -Original Message-
> > From: Chris Earle [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, July 02, 2002 3:54 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: RE: [PHP] Updated (appending) a file
> >
> > More to the point: if that relative path doesn't work, and the path is
> right
> > and the file does exist, what does that mean?
> >
> > -- if the php file is: mydomain.com/index.php
> > -- and the data file is: mydomain.com/files/Names.txt
> > --
> > -- then the relative path is not "\\files\\Names.txt" , it's
> > -- "files\\Names.txt"
> > --
> > -- HTH
> > -- Martin
>
>



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




Re: RE: [PHP] Updated (appending) a file

2002-07-01 Thread Chris Earle

The server has error reporting turned off (can I change this even though I'm
not there?)...

I cannot do it with the file in my base folder either.

"Martin Towell" <[EMAIL PROTECTED]> wrote in message
6416776FCC55D511BC4E0090274EFEF508A58A@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF508A58A@EXCHANGE...
> maybe a permissions thing?
>
> do you get any errors back? if so, what error is it?
>
> try appending to a file in the same directory as index.php and see how
that
> goes.
>
> -Original Message-
> From: Chris Earle [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 02, 2002 3:54 PM
> To: [EMAIL PROTECTED]
> Subject: RE: RE: [PHP] Updated (appending) a file
>
> More to the point: if that relative path doesn't work, and the path is
right
> and the file does exist, what does that mean?
>
> -- if the php file is: mydomain.com/index.php
> -- and the data file is: mydomain.com/files/Names.txt
> --
> -- then the relative path is not "\\files\\Names.txt" , it's
> -- "files\\Names.txt"
> --
> -- HTH
> -- Martin



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




Re: [PHP] Keeping "Secrets" in PHP Files

2002-07-01 Thread Aaron

try this for now.

http://pobs.mywalhalla.net/

depending on how fancy your code is it may not work. Or you'll only have 
to change a few little things.

basically what it does is :

for($bob=1; $bob<10; $bob++){
echo $bob;
$sam=$bob;
}

Converts above to something like

for($edghr354dfga=1; $edghr354dfga<10; $edghr354dfga++){ echo 
$edghr354dfga;$hsfgfsyrtae34dfgdfas=$edghr354dfga; }

basically.


Lazor, Ed wrote:

>Dang.  $2880 is kind of expensive!  I wish they'd base licensing more on how
>many copies your encoded program you sell.
>
>-Original Message-
>http://www.zend.com/store/products/zend-encoder.php
> 
>
>This message is intended for the sole use of the individual and entity to
>whom it is addressed, and may contain information that is privileged,
>confidential and exempt from disclosure under applicable law.  If you are
>not the intended addressee, nor authorized to receive for the intended
>addressee, you are hereby notified that you may not use, copy, disclose or
>distribute to anyone the message or any information contained in the
>message.  If you have received this message in error, please immediately
>advise the sender by reply email and delete the message.  Thank you very
>much.   
>
>  
>




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




Re: [PHP] php & SMS (or phone contact)

2002-07-01 Thread olinux

Most cellular and paging companies provide your
phone/pager with an email address. usually
[EMAIL PROTECTED] 

check out this list of providers and their addressing:
http://www.weblinkwireless.com/customerservice/how2send/index.html

so just use mail() and it looks pretty sweet when your
website sends msg to your phone

olinux


--- Duncan <[EMAIL PROTECTED]> wrote:
> Hi again,
> 
> thx for the replies.
> Well, nagios ... quite a story ... anyway, i spent
> more than 3-4 hours and still didn't get it to work.
> Maybe i should look into it again, if it supports
> that kind of stuff, which really would be just what
> i need :)
> 
> Thanks a lot,
> 
> Duncan
> 


__
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

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




RE: RE: [PHP] Updated (appending) a file

2002-07-01 Thread Martin Towell

maybe a permissions thing?

do you get any errors back? if so, what error is it?

try appending to a file in the same directory as index.php and see how that
goes.

-Original Message-
From: Chris Earle [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 02, 2002 3:54 PM
To: [EMAIL PROTECTED]
Subject: RE: RE: [PHP] Updated (appending) a file

More to the point: if that relative path doesn't work, and the path is right
and the file does exist, what does that mean?

-- if the php file is: mydomain.com/index.php
-- and the data file is: mydomain.com/files/Names.txt
--
-- then the relative path is not "\\files\\Names.txt" , it's
-- "files\\Names.txt"
--
-- HTH
-- Martin

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




RE: RE: [PHP] Updated (appending) a file

2002-07-01 Thread Chris Earle

I didn't want to make a new post, but my "Reply -> Send" button makes
Outlook crash (this isn't the web server! :)).

More to the point: if that relative path doesn't work, and the path is right
and the file does exist, what does that mean?


-- if the php file is: mydomain.com/index.php
-- and the data file is: mydomain.com/files/Names.txt
--
-- then the relative path is not "\\files\\Names.txt" , it's
-- "files\\Names.txt"
--
-- HTH
-- Martin




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




RE: [PHP] Updating (appending) a file

2002-07-01 Thread Martin Towell

if the php file is: mydomain.com/index.php
and the data file is: mydomain.com/files/Names.txt

then the relative path is not "\\files\\Names.txt" , it's
"files\\Names.txt"

HTH
Martin

-Original Message-
From: Chris Earle [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 02, 2002 3:29 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Updating (appending) a file


I cannot figure out how to access the file and update it (which is just
/files/*.txt from where I'll be accesing it -- in other words I'm accessing
it  from mydomain.com/index.php, but the file is
mydomain.com/files/Names.txt).  By update I mean append.  I tried to access
it with the complete local address (C:\\... it's a IIS5 server on Win2k; I
did use the \\).

So, what file path do I use to update (append) a file on the same Windows 2k
server as my web server (/files/*.txt is the location of the file relative
to the PHP code being executed).

I want to be able to update the file on my server (which can be accessed
through FTP the way $Location works out, if I do it manually in the
browser).  My question is how do I go about accessing it?  Do I have to use
the ftp_connect(); functions somehow or can I just go about with something
like this:
---
// This doesn't work though:

  $Location = "ftp://";. $Find->USER .":". $Find->PASS ."@mysite.com/files/".
$Find->BRANCH .".txt";

  if (!$fp = fopen($Location, "a"))
  { // This is always what shows
   Error("Error: 0001.  File (". $Location .") could not be found.");
  }
  else
  {
   if (!fwrite($fp, $Find->Line)) // line is an HTML tag/link (Something
like "http://somesite.com"; ALT="blah">")
   {
Error("Error: 0002. Information was not written.");
   }

   if (!fclose($fp))
   {
Error("Error: 0003.  File close error.");
   }
  }
-



-- 
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] Updating (appending) a file

2002-07-01 Thread Chris Earle

I cannot figure out how to access the file and update it (which is just
/files/*.txt from where I'll be accesing it -- in other words I'm accessing
it  from mydomain.com/index.php, but the file is
mydomain.com/files/Names.txt).  By update I mean append.  I tried to access
it with the complete local address (C:\\... it's a IIS5 server on Win2k; I
did use the \\).

So, what file path do I use to update (append) a file on the same Windows 2k
server as my web server (/files/*.txt is the location of the file relative
to the PHP code being executed).

I want to be able to update the file on my server (which can be accessed
through FTP the way $Location works out, if I do it manually in the
browser).  My question is how do I go about accessing it?  Do I have to use
the ftp_connect(); functions somehow or can I just go about with something
like this:
---
// This doesn't work though:

  $Location = "ftp://";. $Find->USER .":". $Find->PASS ."@mysite.com/files/".
$Find->BRANCH .".txt";

  if (!$fp = fopen($Location, "a"))
  { // This is always what shows
   Error("Error: 0001.  File (". $Location .") could not be found.");
  }
  else
  {
   if (!fwrite($fp, $Find->Line)) // line is an HTML tag/link (Something
like "http://somesite.com"; ALT="blah">")
   {
Error("Error: 0002. Information was not written.");
   }

   if (!fclose($fp))
   {
Error("Error: 0003.  File close error.");
   }
  }
-



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




Re: [PHP] Re: [PHP-DB] blob versus file

2002-07-01 Thread Andy

i also noticed that the images are not cached at all. The other images
comming from the FS are cached just fine. Do u think thats because of the
blob?

Andy


"Mark" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Mon, 1 Jul 2002 14:20:30 +0200, Pierre-Alain Joye wrote:
>On Mon, 1 Jul 2002 14:17:53 +0200
>"andy" <[EMAIL PROTECTED]> wrote:
>
>>Hi there,
>>
>>I am wondering if anybody has experiance in saving images to blob
>>in mysql.
>>
>>I do save images with 1 K and 4 KB to blob fields while I used to
>>save them
>>to file. It seams to me that this is much slower accessing the
>>files. The
>>images take a bit (really short but absolutly noticable) to show up
>>on the
>>site. Is there a way to improve the performance, and why is this
>>happening?
>>I thought the performance might even boost after storing them to
>>blobs.
>
>Not really, the OS filesystem contains features that makes it always
>faster than a sql query

not necessarily for small files like he's talking about. it depends
on the fs but I would guess they'd be pretty close.

>that will increase your network traffic too.

only if the db is accessed across a network (he didn't say it was)

>Inserting images or whatever binary data in a database does not
have>much sense, you could not do a query with this field, cannot
be>indexed (dunno if exists a DB that implement a image indexer ;) ).

the blob field can't be indexed but others (id, filename, keywords,
caption etc..) can, there's lots of cases where it makes sense to put
images in a database.

if I had to guess the problem I'd say its either
1) the db is across a network like you said
or (more likely)
2) you need to create an index on the table. try running the query
manually and see how long it takes to get a result set. when you get
it down to .01 seconds you;re in good shape
hth,




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




Re: [PHP] Re: [PHP-DB] blob versus file

2002-07-01 Thread Mark

On Mon, 1 Jul 2002 14:20:30 +0200, Pierre-Alain Joye wrote:
>On Mon, 1 Jul 2002 14:17:53 +0200
>"andy" <[EMAIL PROTECTED]> wrote:
>
>>Hi there,
>>
>>I am wondering if anybody has experiance in saving images to blob
>>in mysql.
>>
>>I do save images with 1 K and 4 KB to blob fields while I used to
>>save them
>>to file. It seams to me that this is much slower accessing the
>>files. The
>>images take a bit (really short but absolutly noticable) to show up
>>on the
>>site. Is there a way to improve the performance, and why is this
>>happening?
>>I thought the performance might even boost after storing them to
>>blobs.
>
>Not really, the OS filesystem contains features that makes it always
>faster than a sql query

not necessarily for small files like he's talking about. it depends
on the fs but I would guess they'd be pretty close.

>that will increase your network traffic too.

only if the db is accessed across a network (he didn't say it was)

>Inserting images or whatever binary data in a database does not
have>much sense, you could not do a query with this field, cannot
be>indexed (dunno if exists a DB that implement a image indexer ;) ).

the blob field can't be indexed but others (id, filename, keywords,
caption etc..) can, there's lots of cases where it makes sense to put
images in a database.

if I had to guess the problem I'd say its either
1) the db is across a network like you said
or (more likely)
2) you need to create an index on the table. try running the query
manually and see how long it takes to get a result set. when you get
it down to .01 seconds you;re in good shape
hth,


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




[PHP] Re: [PHP-DB] blob versus file

2002-07-01 Thread Andy

is the increase of the network traffic noticable? The query is pretty small
just text. Do u really think this might increase the traffic?

I also noticed that the image is not cached anymore. Is this true for all
blobs, or do I just access them in a wron way?
(I am requesting a php file in the  schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Mon, 1 Jul 2002 14:17:53 +0200
> "andy" <[EMAIL PROTECTED]> wrote:
>
> > Hi there,
> >
> > I am wondering if anybody has experiance in saving images to blob in
mysql.
> >
> > I do save images with 1 K and 4 KB to blob fields while I used to save
them
> > to file. It seams to me that this is much slower accessing the files.
The
> > images take a bit (really short but absolutly noticable) to show up on
the
> > site. Is there a way to improve the performance, and why is this
happening?
> > I thought the performance might even boost after storing them to blobs.
>
> Not really, the OS filesystem contains features that makes it always
faster than a sql query, that will increase your network traffic too.
>
> Inserting images or whatever binary data in a database does not have much
sense, you could not do a query with this field, cannot be indexed (dunno if
exists a DB that implement a image indexer ;) ). Storing relative pathes
gave me always more portabilities between DBM.
>
> In some case, you have to insert images (or every others binary data) in
DB (due to global permissions system only avaible for the DB and not for the
filesystem, for example), but as far is possible, I avoid to do it so.
>
> IMHO :)
>
> pa



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




[PHP] Re: blob versus file

2002-07-01 Thread Andy

that sound verry logical. It seams that most of you are absolutly sure that
saving images to the OS FS is way faster than to blob in mysql.

The main reason why I am trying to do so is because I would like to seperate
my application from the content. Whenever I make an update of the
application I have to move around files which are in a data folder inside
the application. So I was searching for a way to avoid this and keep the
data untouched.

Maybe someone knows a better way to do that?

Thanx for your help guys,

Andy

- Knud I thought this might be of interest for u 2


"Richard Lynch" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:20020701232018.VNIV6023.sccrmhc02.attbi.com@[192.168.1.103]...
> >I do save images with 1 K and 4 KB to blob fields while I used to save
them
> >to file. It seams to me that this is much slower accessing the files. The
> >images take a bit (really short but absolutly noticable) to show up on
the
> >site. Is there a way to improve the performance, and why is this
happening?
>
>
> The file system will almost certainly be *WAY* faster than MySQL.
> (I'm sure somebody can come up with a two-tier system with burning fast
> MySQL and dog-slow hard-drive on the HTTP server, but... let's be real
> here...)
>
> If the images are "too slow" you need to look at your BANDWIDTH, the HTTP
> server speed, and the hard drive speed, and the caching system of the OS.
>
> Moving the images into MySQL is unlikely to really solve any of these.
>
> You could run a quick test, though, in about 15 minutes of work, with a
> single image, just to be sure.
>
> --
> Like Music?  http://l-i-e.com/artists.htm

Not really, the OS filesystem contains features that makes it always faster
than a sql query, that will increase your network traffic too.

Inserting images or whatever binary data in a database does not have much
sense, you could not do a query with this field, cannot be indexed (dunno if
exists a DB that implement a image indexer ;) ). Storing relative pathes
gave me always more portabilities between DBM.

In some case, you have to insert images (or every others binary data) in DB
(due to global permissions system only avaible for the DB and not for the
filesystem, for example), but as far is possible, I avoid to do it so.

IMHO :)

pa



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




Re: [PHP] preg help (regexp newbie) whitespace

2002-07-01 Thread Jason Wong

On Tuesday 02 July 2002 10:06, Justin French wrote:

> what's the correct pattern for "one or more whitespaces" (including \n\r\t
> and anything else I'm missing)?

I prefer the PCRE so:

\s+

> what about "zero or more whitespaces"?

\s*

It's all in the manual!

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Everyone can be taught to sculpt: Michelangelo would have had to be
taught how ___not to.  So it is with the great programmers.
*/


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




[PHP] preg help (regexp newbie) whitespace

2002-07-01 Thread Justin French

Hi all,

what's the correct pattern for "one or more whitespaces" (including \n\r\t
and anything else I'm missing)?

what about "zero or more whitespaces"?

Thanks in advance,

Justin French


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




Re: [PHP] Globals bug??

2002-07-01 Thread troy

When I said "process" I meant "request". Sorry. Is it possible that the PHP
globals are being used across requests (i.e., within the same process)? We
noticed this when upgrading from a version of PHP (4.0.6?) prior to the new
super-globals being added to PHP 4.1.2. 

The code in this case is so straightforward that I can't see any other
explanation. The variable in question comes from the URL. For example, if the
URL is http://foo.com/page.php?var=abc, $var in the PHP is a different value 
in these rare cases.  And the variable we use here is in a very specific 
format and it is a valid value just that it's a different value from the one 
in the URL. 

Also note that we've only seen this problem when the variable has a longer
string than the one in the URL. Using the URL from the above example again,
$var has a value like "abcdef" which is valid value but longer (in addition to
being wrong). It's as if PHP is re-using memory from a previous request and is
not truncating the string properly for the next request.

Does that make more sense? Possible?


Rasmus Lerdorf <[EMAIL PROTECTED]> wrote:
> I don't see how.  But if what you are saying is actually happening, then
> it is a Linux kernel-level bug if memory is leaking from one process to
> another.  No matter how badly we screwed up in PHP, the kernel prevents
> such a screwup from infecting a separate process.

> I'd suggest having a close look at your code.

> -Rasmus

> On 30 Jun 2002 [EMAIL PROTECTED] wrote:

>> We are seeing a rare bug that seems to imply that there is a bug in PHP's
>> global variables across httpd processes. To make a long story short, it
>> appears that on rare occassions our script gets the value of a HTTP_GET_VARS
>> variable from another user's process. Is this possible? BTW, it seems to occur
>> when using HTTP_GET_VARS and the new 'super globals'.
>>
>> FWIW, we're using PHP 4.1.2 on (Red Hat) Linux 2.4.9 with Apache 1.3.12.
>>
>> Thanks!
>>
>> (please reply via email in addition to posting here if possible)
>>
>>
>>
>> --
>> 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] session duration

2002-07-01 Thread Ivan Voras

Is there a way to programatically (inside a session) change session duration
for the current session only? (using cookie-based sessions) ?

--


- Ivan Voras  -
- If I knew what I was doing, it wouldn't be called "research". -- R. P.
Bergman -




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




Re: [PHP] Re: Problem with menu

2002-07-01 Thread Analysis & Solutions

On Mon, Jul 01, 2002 at 08:00:39PM -0400, Analysis & Solutions wrote:
> Hi Richard:

Oops.  Meant to reply directly to Ricahrd.  Sorry 'bout that.

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

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




[PHP] session dropping data

2002-07-01 Thread dietrich

'lo,

anybody ever experience this:

1. i start a session w/ session_start()
2. register some vars w/ session_register()
3. click to next page, everything cool. all vars are there, and session id
is same
4. any other page, all session vars gone, but sessid is still the same.

so session is persisting, but data is being emptied from it.

any help would be excellent.

thanks,

dietrich



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




Re: [PHP] Re: Problem with menu

2002-07-01 Thread Analysis & Solutions

Hi Richard:

Nice to have you back on the list.  I've noticed your replies are not 
winding up back in the threads due to the Reference header not being set 
by Outlook.

While this isn't going to cause the end of the world, it'd be nice if they
were there.

Enjoy,

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

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




RE: [PHP] How to use Session Variables

2002-07-01 Thread Johnson, Kirk

With register_globals on:

1. Put session_start() at the top of each page.
2. Initialize the variable, then call session_register():
$foo = 'bar';
session_register('foo');
3. Do all assignments to $foo, not $HTTP_SESSION_VAR['foo'], since $foo gets
written to $HTTP_SESSION_VAR['foo'] at the end of the current page, and so
will overwrite anything that was assigned to $HTTP_SESSION_VAR['foo'].
4. Because of #3, the value assigned to $foo won't be available in
$HTTP_SESSION_VAR['foo'] until the next page.

Clear as mud? I thought so ;)

Kirk


> -Original Message-
> From: Brandon [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 01, 2002 4:02 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] How to use Session Variables
> 
> 
> Could anybody point me to a good tutorial/howto on how to 
> make a variable
> accessible to all of my PHP pages?  I'm running PHP 4.0.6 with
> register_globals set to ON... (I cant change that).  I've 
> tried with the
> $HTTP_SESSION_VAR,$_SESSION, and session_register() method 
> but just can't
> seem to make it work.  Any help would be appreciated.
> 
> Thanks,
> Brandon
> 
> 
> 
> -- 
> 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] Compiling PHP with INFORMIX howto?

2002-07-01 Thread Emile Bosch

Does someone have a good guide on installing php with informix support? also
i wish to know wheter it
is possible to compile php with this version.

ISQL 7.20
Embedded sql for C. 9.14
4GL 7.30
4GL runtime 7.20
Dynamic server 7.30
Java API1.05

Thanks in advance,
Emile Bosch



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




[PHP] Re: extracting data from text file

2002-07-01 Thread Richard Lynch

>Hello ,
>I have a text file that looks like this. each entry is on a different
>line I need to pull the data out of
>it and put each line of data into its own variable
>
>US
>State
>City
>Company Name
>Section 2
>www.domain.com
>[EMAIL PROTECTED]
>
>I have trend this but it does not work properly
>
>$fp = @fopen(file.txt,"r");
>  $line = explode("\n",$fp);
>  $valueC = "$line[0]";
>  $valueST = "$line[1]";
>  @fclose($fp);

$fp is a NUMBER.
The first file you open is Number 1, the second is number 2, and so on.

So you can't just go explode()ing $fp -- You've got to read some data.

$data = fread($fp, 1); or
$data = fgets($fp, 1); or...

Lots of choices, actually, depending on how the file is layed out.

Now, some questions:

How "regimented" is the data?  Is it *really* clean and always the same
number of lines?

If so, a simple:

$country = fgets($fp, 100);
$state = fgets($fp, 100);
.
.
.

inside of a while(!feof($fp)){ loop will work.

If there are sometimes some "missing" lines, or maybe sometimes two lines
where there should be one, it gets a bit more tricky...

You may need to look into http://php.net/strtok and do some high-falutin'
artificial-intelligence analysis of the data coming it as you read it to
"guess" which line is what...

And definitely get rid of the @ symbol, or AT LEAST check the value of $fp
and do something intelligent if it's no good.

if (!$fp){
  # send error message or whatver.
  exit;
}


-- 
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: uploading a file - here is the error message...

2002-07-01 Thread Richard Lynch

>Here is the error I'm receiving when attempting to upload a file
> 
>Warning: Unable to create 'temp/test.txt': Permission denied in
>/home/.../www/website/upload3.php on line 11
>
> 
>..could it be that my web host isn't giving me permissions to upload
>files ?
>

Yes.  Or at least not where you are trying to put the file...

Give us the first 11 lines of upload3.php please.

It's possible that you simply need to create a world-writable directory for
your uploads.

Do *NOT* *NOT* *NOT* *NOT* *NOT* *NOT* *NOT* create that world-writable
directory *INSIDE* your "web" directory (or htdocs, or where-ever it is that
you are putting your HTML files).

Did you catch that?  It's really important that you not have world-writable
directories in your web server tree...

When you FTP (or SCP, or SSH) in to your account, what do you see *FIRST*?

If it's something like this:

/
/htdocs
/cgi


Then you should create a new directory called "incoming" (or "uploads" or
whatever) there so you see:.

/
/htdocs
/cgi
/uploads

Note that "uploads" is *NOT* inside of "htdocs" but "next to" it.

Then, make *that* directory world-writable.  (Use your FTP software or from
SSH/telnet do):

chmod 777 uploads

*THEN*, alter your PHP script to upload the files to there:

$path = "/full/path/to/uploads";
if (move_uploaded_file($file, "$path/$file_name")){
  # Do *everything* you can think of here to be sure
  # "$path/$file_name" is totally kosher, and is not
  # some hacker binary or porn or whatever you don't
  # want on your server.
  # Once you *know* it's kosher, insert the path into a MySQL table:
  $query = "insert into kosher_uploads (path) values ('$file_name')";
  mysql_query($query) or error_log(mysql_error()); #Check HTTP error log for
errors!
}
else{
  echo "Upload failed!";
}


Then, in a separate script, in a "cron" job (read "man 5 crontab") you can
do:



NOTE:
The first script does not deal well with filename "collisions"
IE, What if *TWO* people upload "Britney.JPEG" at the same time.
(Assuming you want to allow JPEG upload in the first place.)
(And that you don't want to rule out anything named Britney on principle.)
:-)

All this code is just typed in, untested...  But the ideas are sound.  YMMV.

If the real problem is that the upload *ITSELF* is trying to create
temp/test.txt (I think not) then you need to dig into php.ini and/or
.htaccess an alter the file_upload_dir and get that to be a directory that
PHP user can write to (again, a world-writable directory *NOT* inside your
web-tree).  Your ISP may or may not have chosen to make this impossible for
you to do.  No way to tell with the info you've given so far...  Asking the
ISP would be faster/easier on that one.

-- 
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: Web Printing

2002-07-01 Thread Richard Lynch

>Hi all,
>
>Just wondering if anyone came across this "problem" before:
>
>When I print a document directly from my browser, it comes out with the
>title on
>the top right , page number of the top left, address on the bottom left and
>date on the bottom right, Page Headers and Footers
>
>Using IE I can set the page headers and footers under the page setup option.
>
>Header: &w&bPage &p of &P
>Footer: &u&b&d
>
>I need some way of disabling / changing this as my clients print reports
>that need a proper printout. I need to change it using css / vbscript /
>JavaScript ???
>
>Anyone ever worked with this function? I know its not PHP related but im
>sure someone came across the problem.

The only way to reliably generate printable data cross-platform that I am
aware of is PDF...

Fortunately, PHP *can* generate PDF files...

Whether you want to make it possible to convert the content in question to
PDF or not, I dunno...

Is it for every page of your site or specific documents or ???

For sure, you *CANNOT* take over *my* computer and change *MY* settings for
what *I* want on my Header:/Footer: of Web documents.  That simply ain't
gonna happen.

But if you just need a couple reports printable, it is not too terribly
tricky to generate PDF files for them.  Hell, I figured it out, so it can't
be *too* tricky. :-)

-- 
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: ODBC Failures

2002-07-01 Thread Richard Lynch

>List,
> My ODBC connection is failing it seems...I can run this code just 
>fine...odbc_connect and odbc_pconnect seem to work...the odbc_prepare 
>even works just fine...but as soon as I execute (with odbc_execute, 
>odbc_exec, or odbc_do it fails...any ideas?
>
>
>$db = odbc_pconnect("Desire","sa", "");
>echo "Database Connection:".$db."";
>$sql = odbc_prepare($db, "execute spGetItems");
>echo "Prepared SQL id:".$sql."";
>// This line will fail
>$rs = odbc_execute($sql);
>
>?>
>

Is there an odbc_error() function that will maybe clue you in to what's
wrong?...

$rs = odbc_execute($sql) or error_log(odbc_error());

I dunno what the function name is, but I'll get a dollar it's listed here:

http://php.net/odbc

-- 
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: Help: Constants

2002-07-01 Thread Richard Lynch

>Hi,
>
>Maybe it's already discussed here, but PHP is generating errors of undefined
>constants. These constants are defined in my scripts. Als the superglobal
>$_ENV is empty.
>
>Can anyone tell what's wrong here?
>
>I'm using a W2K server, with Apache 1.3.26 and PHP 4.2.1

Check php.ini settings and track_variables or whatever it is...

Actually, use  first to be sure you are looking at the
correct php.ini file.


-- 
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: register_global, need some feedback

2002-07-01 Thread Richard Lynch

>1) $GLOBALS, Where does this come from and where does this goes to?  I
>noticed there is no variable declaration for this, so I just know that it is
>part of PHP codes, although I haven't figure out what is it part of.

Every variable you assign, change, or unset, or that comes in from the
outside world, is in $GLOBALS.

$GLOBALS is PHP's internal array of all variables with their values.

Mucking directly with $GLOBALS in any way shape or form is almost-for-sure a
Bad Idea (tm).

[There are exceptions to this rule...  If you know what you're doing well
enough to be doing those exceptions, go for it.]

>2) What would be the way to go to make it work, when changing it within this
>script with register_global turned on to turned off?
>--clip --
>   while (list($var, $value) = each($GLOBALS[HTTP_POST_VARS])
>{
> $GLOBALS[$var] = stripslashes(trim($value));
>}
>   reset ($GLOBALS[HTTP_POST_VARS]);
>--clip--
>I tried different ways to make it work and I kept getting the error saying
>" Variable passed to each() is not an array or object "
>" Variable passed to reset() is not an array or object "

if (isset($HTTP_POST_VARS)){
  reset($HTTP_POST_VARS);
  while(list($var, $val) = each($HTTP_POST_VARS)){
$$var = $val;
  }
}

You could repeat this code for $HTTP_GET_VARS, $HTTP_COOKIE_VARS, etc.

You could even do it, in order, for all of them, and essentially "undo" the
turning off of register_globals.

Once you've gone that far, it's only a step away to write an "import"
function which takes variable names and/or source (POST, GET, COOKIE) and
sucks in the variables you expect at the top of your script, without sucking
in the potentially damaging crud of a hacker.


# Untested code.  YMMV.

function import($variables = NULL, $source = NULL){
  if (is_array($variables)){
while (list($var, $source) = $variables)){
  # HACK!!!
  # If no source was supplied, the value is the variable, not the key.
  if (is_int($var){
import($var);
  }
  else{
import($var, $source);
  }
}
  }
  else{
global $$var;
if ($source === NULL){
  # Should suck in the ordering from EGPCS thingie in php.ini, really. 
I'm lazy.
  if (isset($HTTP_POST_VARS[$var])){
$$var = $HTTP_POST_VARS[$var];
  }
  elseif (isset($HTTP_GET_VARS[$var])){
$$var = $HTTP_GET_VARS[$var];
  }
  # The remaining elseif clauses for COOKIE, ENV, etc are left as an
exercise for the reader...
}
elseif ($variables != NULL){
  $array = "HTTP_$source_VARS";
  # This next bit might need some syntactic work with those {}s in
there...  Untested code, eh?
  if (isset({$$array}[$var])){
$$var = {$$array}[$var];
  }
}
  }
}


Sample usage, if I got the code correct:

import("foo"); # Imports $foo just like PHP used to
import("foo", 'POST'); # Imports $foo like PHP used to, but only if it's a
POST.
import(array('foo', 'bar'); # Imports $foo and $bar like PHP used to.
import(array('foo'=>'POST', 'bar'=>'GET'); # Imports $foo from POST and $bar
from GET like PHP used to...  Okay, not a whole lot like PHP used to, but
sorta.

NOTE:
If you know your code will never need to run on *older* versions of PHP,
replace $HTTP_POST_VARS with that new-fangled $_POST variable.

NOTE:
All the solutions up to, but not includeing, "function import", completely
bypass the entire *point* of not using register_globals in the first place. 
It should be considered a short-term solution.

-- 
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: mySQL time = year 2038 [HELP]

2002-07-01 Thread Richard Lynch

>Checked the archive and saw no difinitives... so... How come when I query 
>my clients mySQL DB and use NULL or NOW() as my default in a TIMESTAMP 
>record that it always comes up Jan 18, 2038?
>
>Is the clock not set properly, or am I misunderstanding some basic 
>principal of the time stamp?
>
>My clients version pf PHP is 4+ on a Windows IIS server.

Show us some source code...

2038 is the "end of time" for Unix timestamps on 32-bit hardware.

In other words, if you take 0x, that 2 billion number that's the
biggest signed integer you can get with 32 bits, and you try to turn that
into a date/time, you'll get something in March of 2038, which is 2 billion
seconds after JANUARY 1st, 1970, midnight (GMT), which is "0" time.

Most likely, you are somehow convincing MySQL and/or PHP to use some number
very close to 0x and convert that to a time stamp...

-- 
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: Handling of constants in strings

2002-07-01 Thread Richard Lynch

>Hi,
>when reading about constants (define('MY_CONSTANT', 'my value'))
>I got convinced that they are pretty usefull.
>
>But now it seems to me, that I can't use them inside a string:
>$my_string = "This is MY_CONSTANT and I love it!";
>
>but that I must take them out:
>$my_string = "This is" . MY_CONSTANT . "and I love it!";
>
>Isn't there a way around?
>And must I suspect more strange things to come with constants?

Try this:
$my_string = "This is {MY_CONSTANT} and I love it!";

Can't promise it will work, mind you...

It's not all that common to bury constants in strings...  And is the extra "
. " K ". " that big a deal?  Seems a small price for cleaner code.


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

2002-07-01 Thread Richard Lynch

>Is this the place to address it?

There is probably a phpMyAdmin mailing list that would be *FAR* more
suitable...

There might even be a PHP Security mailing list
http://php.net/mailing-lists.php that would be more suitable than here (but
less than the phpMyAdmin list).

If you *really* think it fits best here...

-- 
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] Populate Popup Menu from Database

2002-07-01 Thread Mike Tuller

Thanks for the tip.

> From: Erik Price <[EMAIL PROTECTED]>
> Date: Mon, 1 Jul 2002 17:05:39 -0400
> To: Mike Tuller <[EMAIL PROTECTED]>
> Cc: php mailing list <[EMAIL PROTECTED]>
> Subject: Re: [PHP] Populate Popup Menu from Database
> 
> 
> On Monday, July 1, 2002, at 04:22  PM, Mike Tuller wrote:
> 
>> Thanks. Here is what I did for future reference.
> 
> Good.  What you chose to do is exactly what I do except for one
> thing... :
> 
>> $sql = "select department_name from Departments";
> 
> I generally grab the primary key column value as well, in the same
> query, and then I use that as the "value" attribute for the 
> tags:
> 
>> while($row = mysql_fetch_array($sql_result))
>> {
>> $department = $row["department_name"];
>> echo "$department";
>> 
>> }
> 
> while ($row = mysql_fetch_assoc($result)) {
> $dept_id = $row['department_id'];
> $dept_name = $row['department_name'];
> echo "$department_name\n";
> }
> 
> The reason I do this is because I end up using the ID far more than the
> "name" of a database record -- while I might echo the "name" to the user
> where needed (such as in the above dropdown listbox), the ID comes in
> handy as a reference in hyperlinks, form fields, etc -- it provides
> something that I've discovered is really missing in writing HTML-based
> applications: a unique handle on an object.  This is very hard to
> replicate given the statelessness of HTTP, but with a database record's
> primary key, you always have this unique identifier by which to refer to
> the object.  and a number is more pithy than a name.
> 
> It'll avoid situations where someone enters the same "name" value twice,
> too.  But it's not really a big deal unless you're doing a lot of work
> with a lot of data.
> 
> 
> Erik
> 
> 
> 
> 
> 
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
> 
> 
> -- 
> 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] PHP and PDF

2002-07-01 Thread Richard Lynch

>Would like to see a decent example of PHP/PDF creation anyway...

Depending on how you define "decent"... :-)

Rasmus' trivial samples in his talks at http://conf.php.net are nice and
simplistic, so you can verify that the damn thing works.  These are great,
IMNSHO.

If you want a "real" example, try this:

http://uncommonground.com/events.htm
http://uncommonground.com/events.pdf
http://uncommonground.com/events.phps

The .phps URL is sym-linked to the PDF file, not the HTM file. :-)

YMMV.

-- 
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: Encripted download

2002-07-01 Thread Richard Lynch

>*This message was transferred with a trial version of CommuniGate(tm) Pro*
>
>Hi,
>
>My Apache is under SSL. Everything works Ok but when the user chooses to 
>download a file or view a PDF document, the browser states that you are about 
>to leave the secure conexion, so I guess the files are travelling withno 
>encription.
>
>Questions:
>1. Are the files actually travelling with no encription ?

Are the links going to HTTPS://... or to HTTP:// ... ?

If they are to HTTPS:// ..., then it *SHOULD* be encrypted, I think.

>2. How can I encript them but making it transparent to the user ?

Totally transparent?  Like, so they can't tell at all?  You can't.  How
would they know to trust that the files were securely transmitted if they
weren't?

If you want them to not get notified that they are leaving a secure
connection, then teach them to configure their browser differently...

-- 
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: PHP and PDF

2002-07-01 Thread Richard Lynch

>hello everyone--
>
>i'd like to know if this can be solved with php.
>
>i'll be creating a pdf form that'll be downloaded, filled and turned
>in.
>the form must have a unique NUMBER printed on it each time it is
>downloaded.
>
>i'd like to use php to update this NUMBER (ie. counter + 1) each time
>the form is
>accessed, and automatically print this NUMBER on the form that sits on
>the server.
>
>is this possible?

No problem.

If the rest of the PDF is easy to create, or can be just a JPEG, you can
just use libpdf.

First, you'll need some kind of counter.  Probably trivial to do it with
MySQL, right?

Then, use the PDF library and http://php.net/pdf_show_boxed to paste in the
Serial #.

You could also look into fdf as well, if the rest of the PDF file is really
complicated.

-- 
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] cURL in an exec()

2002-07-01 Thread Richard Lynch

>[snip]
>> print($curlline); > exec($curline);
>
>Have you tried executing $curlline directly from a shell/command-line? This
>will determine whether it is a PHP problem or a cURL problem.
>[/snip]
>
>That was the first thing I did, and I have gone back a couple of times now
>to make sure.

Post an example $curlline with the iteration value plugged in...

Any chance it has, say, quotes or apostrophes in it?  How about unprintable
control characters?  Spaces that don't show up in the browser but that you
can see in "View Source" ? :-)

-- 
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: creating multidimensional arrays

2002-07-01 Thread Richard Lynch

>Hi All
>
>I want to create a multi dimensional arrays as below
>
>$result[$something]['$key_string_01] = value_01
>$result[$something]['$key_string_02] = value_02
>$result[$something]['$key_string_03] = value_03
>$result[$something]['$key_string_04] = value_04
>$result[$something][0] = value_06
>$result[$something][1] = value_07
>$result[$something][2] = value_08
>.
>.
>.
>
>Here is what I did
>1. use some assign statement $result[$something]['$key_string_0n'] =
>value_0n for the first four elements
>2. for the fifth elements onward, I used this
>$result[$something] = preg_split();
>
>However, as I test it with foreach loop, I am only getting
>
>$result[$something][0] = value_06
>$result[$something][1] = value_07
>$result[$something][2] = value_08
>.
>.
>.
>
>I lost the first four elements!! Can anyone help on this please?

What you are doing seems pretty weird to me...

Did you do reset($result) before you looped through the values to display
them?  If not, it *could* be the case that the assignment with the preg is
somehow mis-managing the iteration pointer.  This seems highly unlikely, but
it's the cheapest and easiest answer I have for you.

Just for fun, try using
$result[$something][] = preg_split(...);
and see what it does...

Finally, if all else fails, it's really not worth beating your head against
a wall on this:
$result1[...][...] = 01;
$result1[...][...] = 02;
$result1[...][...] = 03;
$result1[...][...] = 04;

$result2[...] = preg_split(...);

$result = array_merge($result1, $result2);

http://php.net/array_merge

It might still be a bug worth reporting, but it ain't worth waiting for the
PHP Dev team to fix it when you can move on to bigger problems :-)

Actually, I'm not sure it's a bug at all...

The semantics of what an assignment should mean in a situation like this are
not at all clear...

Somebody else could be equally disconcerted that their "old" values are
*NOT* getting wiped out when they do the assignments like that.

I believe that unless you are assigning a SINGLE element into an array, this
issue would be germane.

-- 
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: Reading MSWORD Doc File Comments

2002-07-01 Thread Richard Lynch

>Is there a way to read the comments of a MSWord Doc file. I would like to
>get a directory listing of file in a directory that are mostly MSWORD docs.
>I would like to list the files with a description after each one. With HTML
>files I just read the file into a string and split it just after  and
>then again before  and display that. I am not sure if something can
>be done with a MSWORD doc. Thanks in advance to anyone that can help me or
>chooses to comment.

Perhaps you could use doc2html to convert them on-the-fly?...

There are almost for sure other doc2XXX choices that might get better
results...

I suspect that the meta-data about who wrote the file, when they wrote it,
etc that Word has been keeping for several versions now might also be
something that has public accessors...


-- 
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: Problem with menu

2002-07-01 Thread Richard Lynch

>I have a table with id, pid(parent), title and page_name(url) fields.
>
>The vars provided to the script are the current page's title, id and
>pid(parent)

You can look up the parent and in the database, so it's not horribly
important that those be provided.

*UNLESS* you have a heterarchy, and not a hierarchy -- In other words,
*UNLESS* there are two different "paths" to get to 'id' through different
parents.  In other other words, *UNLESS* you have duplicate id's in the
database...  If you *DO* have a heterarchy, you'd need to track the user's
path as they traveled to know which route to display.

I'll assume you don't have a heterarchy, for now.

>When I am on the parent page I get this(Which is what I want):
>[ Chronological History ][ Website Chronological History ]
>
>When I am in the Child I get this:
>
>[ Website Chronological History ][ Website Chronological History ]
>
>What am I doing wrong???

You really can't get all the parents in one SQL statement.

You'll need to look up the parent.  Then the grand-parent.  Then the
great-grand-parent.  And so on.

Each with a different SQL query.

Now, this is not ideal for performance.

In fact, it's *HORRIBLE* if (A) your tree is really "deep" -- If you have 10
generations of "depth" to the g'great-grand-parents, then it's gonna
take 9 queries to look it up.

If you're only looking at three or four levels, it's really no big deal... 
Unless your site is, like, getting a zillion hits.

Let's assume it's not getting a zillion hits for now, okay?

>I have stared at this two many times now and am probably missing the obvious
>
>function menu($id, $pid, $title) {
>$query = "select * from meta_data WHERE pid = '$id' OR pid = '$pid' &&
>pid != 0";

This will give both the current record and the parent record, but never,
ever, ever, the grand-parent record...

>$result = mysql_query($query);
>$num_results = mysql_num_rows($result);
>  if($num_results != 0){
>  ?>
>
>
>  echo '[ '.$title.' ]';
>for ($i=0; $i < $num_results; $i++)
>  {
>$row = mysql_fetch_array($result);
>if($id == $row['id']){
>echo '[ '.$row['title'].' ]';
>} elseif($row['pid'] == $id || $row['id'] == $pid && $pid != 0) {
>echo '[ href="'.$row['page_name'].'">'.$row['title'].' ]';
>}
>  }
>?>
>
>
>}

Try something more like this:

function menu($id){
  $query = "select pid, title from meta_data where id = $id";
  $meta = mysql_query($query) or error_log(mysql_error()); # Check HTTP
error_log for SQL errors!
  list($pid, $title) = mysql_fetch_row($meta, 0);
  if (isset($pid) && $pid)){
# Switch the menu() and $title parts around if you want bread-crumbs in
the other direction
$result = menu($pid) . $title;
  }
  else{
$result = '';
  }
  return $result;
}

NOTE:

There *ARE* techniques for encoding the SQL in such a way that a single SQL
statement can get the entire "path" at once, but they get kinda complicated
and gnarly, and, really, as I said, if you have a shallow tree, it's just
not worth the hassle...  If you have a really *DEEP* tree, you'll need to do
some more research.

-- 
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: Win98, Apache, PHP Config Problem

2002-07-01 Thread Richard Lynch

>Good morning!
>
>Over the weekend I attempted to set up another test platform on a Win98
>laptop, running Apache as the server and MySQL as the database engine. Just
>want to use it for some testing locally. No matter what I attempted I could
>not get PHP to work. I followed suggestions from;
>
>http://www.php.net/manual/en/install.windows.php
>
>I tried some other experiments, and finally gave up. I would either get file
>not found messages, or a server error. Has anyone ever done this kind of
>install, and if so, is there something I can do to get it working? If not I
>am going to install Linux on the laptop.

Which server error?...

Also try different browsers.  They all suck at accurately reporting what is
going on with the server, but sometimes one has a better message than the
other...

Any errors in your Apache error logs?

Did you try to do CGI or Module install?

-- 
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: php install

2002-07-01 Thread Richard Lynch

>Hi, I'm trying to install PHP 4.2.1 on SuSE SLES 7.3 and I get the following
>error message
>
>checking lex output file root... ./configure: lex: command not found
>configure: error: cannot find output from lex; giving up

lex is like this low-level thingie that lets PHP syntax like
if/else/while/for get defined.
[Gross over-simplification of the whole process, but not totally
inaccurate.]

So, like, you have to have lex installed to build PHP.

The thing is, it's a pretty common thing to have, so it's *MOST* likely on
your computer somewhere, just PHP isn't finding it...


Try these, in order, to see if you have lex somewhere:

whereis lex
locate lex
find / -name lex -print


The last one will take a *LONG* time, maybe...

Once you figure out where "lex" is, you need to get that directory into your
"$path" (or $PATH) variable.

Try these:

echo $PATH
echo $path

Depending on your OS and the phase of the moon, one of them will output
something.

Whichever it is, you need to alter.  How to alter it depends on your OS and
shell and the phase of the moon.  I usually go digging through my .profile
and any .*sh* files in my home directory:

cd
ls -als 

And in one of those files that starts with a "." for the file name I can
usually find out how to alter my $PATH ($path).

If, by some miracle, you don't *HAVE* lex, you can almost-for-sure install
it from your original CDs or find it using Google.

The preceeding all assume a minimal level of Un*x skill...  Which is what
I've got.  YMMV.  Not applicable in all OS'es.

-- 
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: blob versus file

2002-07-01 Thread Richard Lynch

>I do save images with 1 K and 4 KB to blob fields while I used to save them
>to file. It seams to me that this is much slower accessing the files. The
>images take a bit (really short but absolutly noticable) to show up on the
>site. Is there a way to improve the performance, and why is this happening?

Each image request is a separate HTTP connection.

This is true REGARDLESS of whether they are stored in file system or in
MySQL.

The file system will almost certainly be *WAY* faster than MySQL.
(I'm sure somebody can come up with a two-tier system with burning fast
MySQL and dog-slow hard-drive on the HTTP server, but... let's be real
here...)

If the images are "too slow" you need to look at your BANDWIDTH, the HTTP
server speed, and the hard drive speed, and the caching system of the OS.

Moving the images into MySQL is unlikely to really solve any of these.

You could run a quick test, though, in about 15 minutes of work, with a
single image, just to be sure.

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

2002-07-01 Thread Richard Lynch

In article <[EMAIL PROTECTED]> ,
[EMAIL PROTECTED] (Bb) wrote:

>I'm having a problem using strip_tags.
>
>When I try and run a table through strip_tags with the following vars, it
>looses everything after the first cell with content in, i.e: nothing after
>the first cell is returned, not even a 
>
>can anyone help?
>
>is this a PHP bug?

Post sample HTML source that does this...

My best guess is that your TD tag is missing the > or some other tag is
messed up...

Or a missing quote could do this as well.

-- 
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] Re: fsockopen and HTTP/1.1???

2002-07-01 Thread Chris Shiflett

Richard Lynch wrote:

>Secondly, I think it's probably just a Bad Idea (tm) to try to force HTTP to
>do 2 files in one connection anyway -- It just complicates your life, and is
>giving you headaches already...  How much worse will it get in a year?
>

Actually, it's a very good idea and very well supported. Even with 
HTTP/1.0, Web servers support persistent connections; the client simply 
has to ask for it with the "Connection: Keep-Alive" header. In HTTP/1.1 
(obviously the Web server he was dealing with), you have to ask for the 
server to close the connection with a "Connection: Close" header, 
because persistent connections are the default behavior.

>That said, I suspect that fgets() is looking for a particular character all
>by itself on a line that determines the end of a file.  Control-D, possibly.
>So, *MAYBE* sending a chr(4) (control-D) after each file will work...
>

The problem has nothing to do with fgets actually. If the Web server 
doesn't close the connection, the client doesn't close the connection, 
and the client endlessly loops waiting for more content, it's going to 
hang. That's to be expected. :)

>Disclaimer:  I'm not promising any of this is correct -- mostly guess-work
>here.
>

I explained this more thoroughly here:
http://marc.theaimsgroup.com/?l=php-general&m=102522127531834&w=2

Cheers.

Chris



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




RE: [PHP] mySQL time = year 2038 [SOLVED]

2002-07-01 Thread David Freeman


 > Yep, I was using the DATE() function in PHP to convert a 
 > TIMESTAMP from a MySQL DB query. I was getting a year of 
 > 2038 because MySQL and PHP use different TIMESTAMP formats.

 >  $getmyTime = mysql_query("SELECT UNIX_TIMESTAMP(timestamp_col)
AS yournamehere FROM 
 > myDBnamehere WHERE id = $whatever")
 >   or die("Invalid query");

If you mainly need to output a date in a particular format you might
find it more effective to use mysql's date formatting capabilities.
Have a look in the manual for the section on DATE_FORMAT() which will
let you get the date out of your table in just about any format you
desire.

CYA, Dave




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




[PHP] [lee@piclab.com: Re: [PHP] Re: Drop connection, keep running?]

2002-07-01 Thread Lee Daniel Crocker

> (Chris Shiflett <[EMAIL PROTECTED]>):
> John Wulff wrote:
> 
> I have never heard of someone wanting to do this, but you might want to 
> look into methods of executing shell commands in the background, which 
> seems like it should be possible. Basically, you're wanting to execute 
> something that immediately returns control back to your PHP script. The 
> PHP script *must* complete before it will be "finished" from the Web 
> server's perspective. Thus, you'll have to at least split up the logic 
> you want to do later into a separate script and just figure out how to 
> get that running just before your script terminates. If it's written in 
> PHP, don't forget about the CLI; it might come in handy for you in this 
> case.
> 
> Let us know what you come up with.

Yeah, I could do that but I don't really want to spawn a whole process
and copy over all the data that's there already.  In a Java servlet
this is a piece of cake--you just spin off a thread to do the work and
return from the request thread.  Here I'd want to do something like a
fork(), then exit the parent and do some processing in the child.

The PHP manual says that the pcntl() functions (which include forking)
are not available from with a web server context, so I guess Apache
doesn't like its modules forking off demons.

-- 
Lee Daniel Crocker <[EMAIL PROTECTED]> 
"All inventions or works of authorship original to me, herein and past,
are placed irrevocably in the public domain, and may be used or modified
for any purpose, without permission, attribution, or notification."--LDC

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




RE: [PHP] mySQL time = year 2038 [SOLVED]

2002-07-01 Thread Shane

Yep, I was using the DATE() function in PHP to convert a TIMESTAMP from a MySQL DB 
query. I was getting a year of 2038 because MySQL and PHP use different TIMESTAMP 
formats.

There are several FUNCTIONS that convert the two TIMESTAMPS from one to the other, 
(see comments in PHP manuals) but I wound up using the call from a mySQL query to 
convert the data.

much like this
// GET CONVERTED MYSQL TIME TO UNIX TIME
$getmyTime = mysql_query("SELECT UNIX_TIMESTAMP(timestamp_col) AS yournamehere 
FROM myDBnamehere WHERE id = $whatever")
 or die("Invalid query");
 $mysqlTime = mysql_result($getmyTime, 0, 0);
// TURN TIME INTO VIEWABLE STRING
 $myTime = date("F j, Y  @ h:i A", $mysqlTime)." EST";

This spits back "July 1, 2002 @ 04:41 PM EST" instead of some year in 2038 when I did 
the same thing without the SELECT UNIX_TIMESTAMP query.

Thanks again for all your replies.
PHP RULES! (insert white boy dance here)
- NorthBayShane


-Original Message-
From: Shane 
Sent: Monday, July 01, 2002 9:39 AM
To: [EMAIL PROTECTED]
Subject: [PHP] mySQL time = year 2038 [HELP] 


Checked the archive and saw no difinitives... so... How come when I query my clients 
mySQL DB and use NULL or NOW() as my default in a TIMESTAMP record that it always 
comes up Jan 18, 2038?

Is the clock not set properly, or am I misunderstanding some basic principal of the 
time stamp?

My clients version pf PHP is 4+ on a Windows IIS server.

Any clues???
Thanks
-NorthBayShane

-- 
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] How to use Session Variables

2002-07-01 Thread Brandon

Could anybody point me to a good tutorial/howto on how to make a variable
accessible to all of my PHP pages?  I'm running PHP 4.0.6 with
register_globals set to ON... (I cant change that).  I've tried with the
$HTTP_SESSION_VAR,$_SESSION, and session_register() method but just can't
seem to make it work.  Any help would be appreciated.

Thanks,
Brandon



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




Re[5]: [PHP] PHP and PDF

2002-07-01 Thread Mirza Muharemagic

Hi Jason,

 yes, in the theory is possible, but not it in the real life (for fre
 :) ). no, just joking, thanx for the information. very usefull.

 Mirza [EMAIL PROTECTED]


01.07.2002 20:38

> On Tuesday 02 July 2002 00:15, Mirza Muharemagic wrote:
>> Hi Gregory,
>>
>>  u mean, u want to update an existing PDF file? no, thats not
>>  possible.

> In theory it is possible. The people who make the PDFLib library also has a 
> library for modifying existing pdfs. Look on their website for more details. 

> -- 
Jason Wong ->> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *

> /*
> Hurd and architecture in one sentence? Uh-oh...

> - Al Viro on linux-kernel
> */



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




RE: [PHP] extracting data from text file

2002-07-01 Thread Beverly Steiner

Here's one way assign each line:

";
echo "state is $state";
echo "city is $city";
echo "comapny is $company";
echo "division is $division";
echo "url is $url";
echo "email is $email";

fclose($whattoread);
?>


Bev

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 01, 2002 5:17 PM
To: php-general
Subject: [PHP] extracting data from text file


Hello ,
I have a text file that looks like this. each entry is on a different
line I need to pull the data out of
it and put each line of data into its own variable

US
State
City
Company Name
Section 2
www.domain.com
[EMAIL PROTECTED]

I have trend this but it does not work properly

$fp = @fopen(file.txt,"r");
  $line = explode("\n",$fp);
  $valueC = "$line[0]";
  $valueST = "$line[1]";
  @fclose($fp);

-- 
Best regards,
 rdkurth  mailto:[EMAIL PROTECTED]


-- 
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] odbc_fetch_into, broken???

2002-07-01 Thread Scott Fletcher

Hi!

I seem to have problem with the odbc_fetch_into function and it seem to
be broken.  It skipped some columns when retrieving data from the two
tables. I didn't have that problem with the previous version of PHP.  I'll
include the sample of the function code for your convience.  Does anyone
have this problem?  Know what hte problem is?  Know hte workaround to it?
The error seem not to be the result of my doing, but of PHP's doing.  Please
no more changing of hte parameter to the odbc_fetch_into function.

--clip--
PHP version 4.0.5
 odbc_fetch_into($result,1,&$user_detail);

PHP version 4.0.6
$row = 1;
 odbc_fetch_into($result,$row,$user_detail);

PHP version 4.2.1
 odbc_fetch_into($result,$user_detail,1);
--clip--

Thanks,
 FletchSOD



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




[PHP] ODBC Failures

2002-07-01 Thread David Busby

List,
My ODBC connection is failing it seems...I can run this code just 
fine...odbc_connect and odbc_pconnect seem to work...the odbc_prepare 
even works just fine...but as soon as I execute (with odbc_execute, 
odbc_exec, or odbc_do it fails...any ideas?

";
$sql = odbc_prepare($db, "execute spGetItems");
echo "Prepared SQL id:".$sql."";
// This line will fail
$rs = odbc_execute($sql);

?>


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




Re: [PHP] extracting data from text file

2002-07-01 Thread Pushkar Pradhan

Just use file(), this is most appropriate for reading file line by line.
http://www.php.net/manual/en/function.file.php
>
> On Monday, July 1, 2002, at 05:17  PM, [EMAIL PROTECTED] wrote:
>
> > I have trend this but it does not work properly
> >
> > $fp = @fopen(file.txt,"r");
> >   $line = explode("\n",$fp);
> >   $valueC = "$line[0]";
> >   $valueST = "$line[1]";
> >   @fclose($fp);
>
> What error messages are you getting?  I imagine that since you've
> suppressed the errors with the "@", you will need to remove this to give
> us any useful information.
>
> One other thing, has your file been saved with the appropriate line
> breaks for your server?  In some cases, a file may have DOS/Windows or
> Macintosh line breaks which are not \n but rather \r\n and \r
> respectively IIRC.
>
>
> Erik
>
>
>
>
> 
>
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] extracting data from text file

2002-07-01 Thread Erik Price


On Monday, July 1, 2002, at 05:17  PM, [EMAIL PROTECTED] wrote:

> I have trend this but it does not work properly
>
> $fp = @fopen(file.txt,"r");
>   $line = explode("\n",$fp);
>   $valueC = "$line[0]";
>   $valueST = "$line[1]";
>   @fclose($fp);

What error messages are you getting?  I imagine that since you've 
suppressed the errors with the "@", you will need to remove this to give 
us any useful information.

One other thing, has your file been saved with the appropriate line 
breaks for your server?  In some cases, a file may have DOS/Windows or 
Macintosh line breaks which are not \n but rather \r\n and \r 
respectively IIRC.


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




[PHP] extracting data from text file

2002-07-01 Thread rdkurth

Hello ,
I have a text file that looks like this. each entry is on a different
line I need to pull the data out of
it and put each line of data into its own variable

US
State
City
Company Name
Section 2
www.domain.com
[EMAIL PROTECTED]

I have trend this but it does not work properly

$fp = @fopen(file.txt,"r");
  $line = explode("\n",$fp);
  $valueC = "$line[0]";
  $valueST = "$line[1]";
  @fclose($fp);

-- 
Best regards,
 rdkurth  mailto:[EMAIL PROTECTED]


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




Re: [PHP] Populate Popup Menu from Database

2002-07-01 Thread Erik Price


On Monday, July 1, 2002, at 04:22  PM, Mike Tuller wrote:

> Thanks. Here is what I did for future reference.

Good.  What you chose to do is exactly what I do except for one 
thing... :

> $sql = "select department_name from Departments";

I generally grab the primary key column value as well, in the same 
query, and then I use that as the "value" attribute for the  
tags:

> while($row = mysql_fetch_array($sql_result))
> {
> $department = $row["department_name"];
> echo "$department";
>
> }

while ($row = mysql_fetch_assoc($result)) {
$dept_id = $row['department_id'];
$dept_name = $row['department_name'];
echo "$department_name\n";
}

The reason I do this is because I end up using the ID far more than the 
"name" of a database record -- while I might echo the "name" to the user 
where needed (such as in the above dropdown listbox), the ID comes in 
handy as a reference in hyperlinks, form fields, etc -- it provides 
something that I've discovered is really missing in writing HTML-based 
applications: a unique handle on an object.  This is very hard to 
replicate given the statelessness of HTTP, but with a database record's 
primary key, you always have this unique identifier by which to refer to 
the object.  and a number is more pithy than a name.

It'll avoid situations where someone enters the same "name" value twice, 
too.  But it's not really a big deal unless you're doing a lot of work 
with a lot of data.


Erik





Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




Re: [PHP] Re: checking

2002-07-01 Thread Uli B

"==" (2) is for comparison while you are accidently doing assignments by
"=" (1)
if ($lastname="") - wrong
if ($lastname=="") - better
that's why u r screwed up here :-)

Uli

At 17:49 30.06.02 -0500, Richard Lynch wrote:
>In article <03d201c21db6$7deb2110$7800a8c0@leonard> , [EMAIL PROTECTED]
>(Leo) wrote:
>
>>I have a form and I don't want to insert recording with blank value.
>>I put:
>>if ($lastname="") {
>>$insert="no"
>>}
>>if ($insert="no"){
>>do not insert;
>>else
>>insert;
>>}
>>my probleme is in some case $lastname="" is true and other case is false.
>>I tried with $lastname=" " but no change. how can I check if a varible is
>>empty or not?
>
>
>if (isset($lastname)){
>  # Do MySQL insert
>}
>
>http://php.net/isset
>
>NOTE:
>CHECKBOX variables will not show up unless checked, so this technique will
>not necessarily work for them, depending on what business logic you are
>trying to achieve...
>
>-- 
>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] str_replace() not accepting arrays?

2002-07-01 Thread Peter

Hi,

In the documentation it says that str_replace() accepts an array as its subject.  I 
have been trying to use it with a multidimensional array, but 
keep on getting the following error:

Notice: Array to string conversion in c:\code\xml\index.php on line 85

And my arrays are flattened :-(

$foo = array(
'0' => array('foo => 'bar'),
'1' => array('fff' => 'f',
'feen' => 'foo')
);

Returns an array like
Array ( [0] => Array [1] => ) when printed out.

Is the documentation wrong or is PHP 4.2.1 broken?

Thanks
Peter



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




[PHP] Re: Help adding variables from MySQL query

2002-07-01 Thread Richard Lynch

>I'd like to add all values for $purchase_price that are returned, how do I
>do this?
>Here's what i have now.
>$result = mysql_query("SELECT purchase_price FROM assets where
>order_number='$order_number' ORDER BY $desc");

$total = 0;

>while(list($purchase_price) = mysql_fetch_row($result)) {

echo "$purchase_price\n";
$total += $purchase_price; # Short-hand for $total = $total +
$purchase_price;
}

>?>


Actually, it might be better to just change your SQL to:

select SUM(purchase_price) from assets where order_number = '$order_number'

The SQL SUM() will be *MUCH* faster than your while () loop.

-- 
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: [mail] quetion

2002-07-01 Thread Richard Lynch

>What is best:
>1) calling n-times the function mail() [with n = numer of emails] or
>2) calling 1 time mail() and use CC
>?
>Or it it is the same thing?

2) is INFINITELY superior.

Every call to mail() fires up a very large program.

You do *NOT* want to do that more than a few times in one script.

Your server also may limit the number of Cc: (or Bcc:) addresses you can
use.

You may also want to consider talking directly to your SMTP server instead.

There are some excellent mail scripts/classes that take care of all this for
you, if installed properly.

See http://upperdesign.com for one example


-- 
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: ZIP combinaton in PHP?

2002-07-01 Thread Richard Lynch

>I realise its a longshot but is it possible to use PHP (or any other
>web-based languages) to combine multiple ZIP files into a single ZIP file?
>and any scripts i can download to do it.
>
>Any help with this is most appreciated. ;-)

If you can figure out how to do it on the command line, you can get PHP to
execute those commands:

http://php.net/exec

Performance of the ZIP process will remain the same, but on a busy server, a
lot of "exec" calls is not so good.

-- 
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: Easier way to seperate variables?

2002-07-01 Thread Richard Lynch

>I am trying to put a variable within a print <<< END.  The thing is, I 
>want text directly after it - which php will include in the variable 
>name.  I have to END; and use another print $variable;.  Is there an 
>easier way to seperate the variable?

I think if you put {} around the variable, you'll get what you want...

Or, at least, it works in a regular old string.  Dunno about the Here-Doc
crapola -- Never got into it. :-)


-- 
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: Getting all letters not in a string?

2002-07-01 Thread Richard Lynch

>What is the easiest way to get an array of all letters not in a string? I.e.
>$array = notinstring("abc"); //returns array of:
>d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
>
>

I think this might do it:

$alphabet = 'abcdefghijklmnopqrstuvwxyz';
$abc = 'abc';
for ($i = 0; $i < strlen($abc); $i++){
$abcs[] = $abc[$i];
}

$notabc = preg_replace($abcs, '', $alphabet);
for ($i = 0; $i < strlen($notabc); $i++){
  $notabcs[] = $notabc[$i];
}

-- 
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] Populate Popup Menu from Database

2002-07-01 Thread Mike Tuller

Thanks. Here is what I did for future reference.


 -- Select a Department -- 

$department";

}
?>





> From: Erik Price <[EMAIL PROTECTED]>
> Date: Mon, 1 Jul 2002 09:18:12 -0400
> To: Mike Tuller <[EMAIL PROTECTED]>
> Cc: php mailing list <[EMAIL PROTECTED]>
> Subject: Re: [PHP] Populate Popup Menu from Database
> 
> 
> On Saturday, June 29, 2002, at 11:41  AM, Mike Tuller wrote:
> 
>> What is here is beyond my understanding, and seems like it is a little
>> much
>> for what I need.
>> 
>> Here is what my database table looks like:
>> 
>> Departments
>> department_id
>> department_name
>> 
>> I just want to list the department name in the popup.
> 
> although I wrote this instruction in response to a question about
> integrating the listbox with javaScript, ignore the JS stuff, and you
> will see how to dynamically populate a listbox with database data:
> 
> http://marc.theaimsgroup.com/?l=php-general&m=102503848224300&w=2
> 
> 
> 
> 
> 
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
> 
> 
> -- 
> 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: MySQL fetch data

2002-07-01 Thread Cal Evans

Jeff,

Also, try php.weblogs.com ADODB if you absolutly MUST have all of your data
in an array.

I'll agree with Richard that it's not a great idea unless there is a
specific need.  While loops for displaying the contents of many records are
much better. (IMHO, etc...)

=C=

*
* Cal Evans
* Journeyman Programmer
* Techno-Mage
* http://www.calevans.com
*


-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED]]
Sent: Sunday, June 30, 2002 5:41 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: MySQL fetch data


In article <00e001c21db3$7b1b66a0$0a01a8c0@jcowart> , [EMAIL PROTECTED]
(Jefferson Cowart) wrote:

>Is there any way to return all the rows returned by a mysql query with
>one command. Currently I have to run through a for or while loop the
>same number of times as there are rows and take that row and copy it to
>an array. I end up with an array of arrays but it seems like it would be
>a common enough problem that the function would already exist.

Why do you think you need the data in an array?  Usually, you can just deal
with it immediately and discard it.

I think Oracle lets you snatch a whole array at once, but not MySQL.

If you screw up your SQL, you don't want to try to snatch the whole thing at
once anyway -- The potential for trashing your web/db-server by asking for,
oh, 10,000 records at once is just too high.

Better safe than sorry.

--
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] Where do I specify a DSN? v0.2

2002-07-01 Thread Jay Blanchard

What kind/version of DB?


-Original Message-
From: David Busby [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 01, 2002 2:55 PM
To: php-general
Subject: [PHP] Where do I specify a DSN? v0.2


List,
Guess I should be more specific:

Heres line four:
$db = odbc_connect("somedsn","sa", "");

My System:
RedHat 7.3/Apache/PHP 4.1.2-7
I'm getting this error message...I think I just need to define the 
DSN...is that done in /etc/odbc.ini?  Or what?

/B

Warning: SQL error: [unixODBC][Driver Manager]Data source name not
found, and no default driver specified, SQL state IM002 in SQLConnect in
/var/www/html/index.php on line 4@


-- 
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Generating Barcodes and printing

2002-07-01 Thread Richard Lynch

In article <[EMAIL PROTECTED]> , [EMAIL PROTECTED] (Phpcoder)
wrote:

>I would like to generate barcodes and have it print out the barcode 
>automatically from awebpage, is this possible? How?

There is some C code on some web-site with "milk" in the domain name that
will generate a bar-code...

I've been meaning to port that to PHP since forever...

I think it only handles UPC (the standard you see on most every product you
buy).

There are actually a bazillion bar-codes out there, and you could even
generate your own custom one if you really felt the need...

As far as printing goes, I have printed JPEG output from said web-site,
printed it, and verified that the stock-boy at my local K-Mart could scan
that bar-code.  They still don't stock my music CDs, but I was pretty sure
it would work just about anywhere else after that test run.

-- 
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: help pls!

2002-07-01 Thread Richard Lynch

In article <009201c21dd4$a1c96d80$9600a8c0@ady> , [EMAIL PROTECTED] (Adi)
wrote:

>how to make a changerate.php file for:
>
>Read a file: rate.php
>Find string : 'USD' => '0.33'
>Put '0.33' value in an editable textbox. I can change this value, let's say 
>to 0.35;
>I Have an Update Button, when I press, the new value (0.35) change with old 
>value (0.33) in rate.php like this: 'USD' => '0.35'

First, don't use "help pls!" as a subject.  That will get ignored by many
readers.

Secondly, you *REALLY* should put this stuff into a DATABASE, not a file. 
Honest.  It's going to be much *EASIER* if you do.

Here's the PHP for what you think you want, but you really don't:

 '$rate'";
  $charcount = fputs($file, $line);
  if ($charcount != strlen($line)){
echo "Only wrote $charcount out of ", strlen($line), "
characters!\n";
  }
}
  }
?>
 METHOD=POST>
', $line);
$country = trim($parts[0]);
$rate = trim($parts[1]);
$country = substr($country, 1, -1); # Strip off apostrophes.
echo "$country \n";
  }
?>



-- 
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: fsockopen and HTTP/1.1???

2002-07-01 Thread Richard Lynch

In article <[EMAIL PROTECTED]> , [EMAIL PROTECTED] (Alex
Elderson) wrote:

>open connection to webapps.hardinxveld.netflex.nl oke
>
>  get / done
>  get / failt
>
>Closing connection to webapps.hardinxveld.netflex.nl oke
>
>
>The problem is the "Connection: Close\n\n" header. The webserver close the 
>connection after the first request, if i remove 
>the "Connection: Close\n\n" header the first fgets($web_conn, 128) command 
>will never ends.
>
>It's running on winXP apache 2.0.36 PHP 4.2.1 (test server) from the shell

First of all, you need to be aware that a web-server is not required to
respond using HTTP/1.1 just because you asked for it...  If the web-server
don't feel like doing HTTP/1.1, it can fall back to HTTP/1.0 in its
response.
[At least, that's how I understand it...]

So this whole multiple-file thingie may not work if, as I suspect, HTTP/1.0
doesn't support multiple files in one connection.

Secondly, I think it's probably just a Bad Idea (tm) to try to force HTTP to
do 2 files in one connection anyway -- It just complicates your life, and is
giving you headaches already...  How much worse will it get in a year?

That said, I suspect that fgets() is looking for a particular character all
by itself on a line that determines the end of a file.  Control-D, possibly.
 So, *MAYBE* sending a chr(4) (control-D) after each file will work...

Even if it does work, I still think it's a Bad Idea -- I'm not sure fgets()
is DOCUMENTED to use the Control-D, so there's no guarantee it will keep
working.  More headaches next week/month/year.

Disclaimer:  I'm not promising any of this is correct -- mostly guess-work
here.

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

2002-07-01 Thread Richard Lynch

In article <03d201c21db6$7deb2110$7800a8c0@leonard> , [EMAIL PROTECTED]
(Leo) wrote:

>I have a form and I don't want to insert recording with blank value.
>I put:
>if ($lastname="") {
>$insert="no"
>}
>if ($insert="no"){
>do not insert;
>else
>insert;
>}
>my probleme is in some case $lastname="" is true and other case is false.
>I tried with $lastname=" " but no change. how can I check if a varible is
>empty or not?


if (isset($lastname)){
  # Do MySQL insert
}

http://php.net/isset

NOTE:
CHECKBOX variables will not show up unless checked, so this technique will
not necessarily work for them, depending on what business logic you are
trying to achieve...

-- 
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: MySQL fetch data

2002-07-01 Thread Richard Lynch

In article <00e001c21db3$7b1b66a0$0a01a8c0@jcowart> , [EMAIL PROTECTED]
(Jefferson Cowart) wrote:

>Is there any way to return all the rows returned by a mysql query with
>one command. Currently I have to run through a for or while loop the
>same number of times as there are rows and take that row and copy it to
>an array. I end up with an array of arrays but it seems like it would be
>a common enough problem that the function would already exist. 

Why do you think you need the data in an array?  Usually, you can just deal
with it immediately and discard it.

I think Oracle lets you snatch a whole array at once, but not MySQL.

If you screw up your SQL, you don't want to try to snatch the whole thing at
once anyway -- The potential for trashing your web/db-server by asking for,
oh, 10,000 records at once is just too high.

Better safe than sorry.

-- 
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: Accessing cookies in required files

2002-07-01 Thread Richard Lynch

In article <[EMAIL PROTECTED]> ,
[EMAIL PROTECTED] (Chris Morrow) wrote:

>Up until now this has worked fine. But now I have a function in the
>settings.inc file that tries to read the value of a cookie called
>"testcookie". My problem is that the settings.inc file doesn't seem to be
>able to access the cookie at all. But if I try to access it direct from a
>page rather than the required file it works fine.

It has nothing to do with the require and *everything* to do with the
FUNCTION.

You see, it's a really Bad Idea (tm) to have your functions use variables
from the "outside" world -- variables should be passed in as parameters.

function foo (parameter, parameter, ..., parameter){
.
.
.
}

Inside the function "foo" there are *NO* variables except the "parameter"
variables.

You can over-ride this, though, using "global"

function foo (parameter, parameter, ..., parameter){
  global $cookie1;
.
.
.
}

EXCEPTION:
The new-fangled "superglobals" $_POST, $_GET, $_COOKIE etc are global
everywhere.

So you *could* use $_COOKIE['cookie1'] without using "global".

This rule about variable scope is a FEATURE -- Without it, the function is a
relatively weak little thing, and you are all to likely to have stupid,
stupid, stupid bugs from variable name conflicts and a million lines of PHP
code on your web-server to find the mistake...  With the rule that only the
paramters (and globals) can exist inside a function, you limit your problem
search to a very much smaller space.
-- 
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: Display Records in Multiple Pages

2002-07-01 Thread Richard Lynch

In article <009a01c21da7$7c215b60$1300a8c0@redplanet> , [EMAIL PROTECTED]
(Aqua) wrote:

>I have 100 records in mySQL database and I need to display them in my web 
>page using php and html. How to display them in multiple pages? Each page 
>must contain 25 records. Does anyone know how to do it other than create 4 
>pages and manually list the records there? or maybe point me some reference 
>please. Your help will be much appreciated. Thanks!

Search MySQL's site or PHPBuilder/WeberDev/etc for an example of the LIMIT
clause.

Or, very briefly:

\n";
  }
  echo "Prev";
  echo "Next";
?>

You'll want to check that you don't go over 100 or under 0, and that there
actually *IS* a Next/Prev page, but this is the core of it.

-- 
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: Yet another session problem, with a twist.

2002-07-01 Thread Richard Lynch

In article <[EMAIL PROTECTED]> ,
[EMAIL PROTECTED] (Cysec) wrote:

>I have already scripted a site using PHP 4 and was at the point of uploading
>it to my client's chosen server (decided to go third party) when I discover,
>their server is running PHP3, launch is in five days, and I have 40+ pages
>using PHP4's session handling (session_start() etc.).  This would be a total
>pain to change throughout the site, so I was wondering if anyone knew of a
>script of functions that emulate PHP4's session handling.  I would love to
>be able to just update the server, and would have if it were one I was
>administrating, however I can't.  Any help would be vastly appreciated.

Woof.

PHP's session() stuff was kinda sorta loosely modeled after the (old) PHPLib
stuff, so you *MIGHT* be able to find that and use it...

I don't foresee that happening in 2 days (and counting) though...

-- 
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: gdlib list or galleries?

2002-07-01 Thread Richard Lynch

In article <[EMAIL PROTECTED]> , [EMAIL PROTECTED] (William S.)
wrote:

>Is there a mailing list just dedicated to gdlib
>or any places that show a gallery with examples?
>I would be interested in seeing examples
>of images that are complex/artistic and beyond
>simple rectangles and boxes.

It's a work in progress, but you may find these images of interest:

http://chatmusic.com/maplocater.htm

Those ugly red circles (I am not a Designer) and the longitude/latitude
lines are coming from a database of ~2000 music venues for touring musicians
to utilize (http://chatmusic.com/venues.htm).

Only the World -> US "demo path" is working at this time.  Pages after that
are "in development"  Knock yourself out uploading more detailed maps, if
that is working at the time you play, but no promise I'll keep them...

Anyway, in spite of the paucity of maps, there is some non-trivial data
being overlaid onto the underlying regional images, and the
longitude/latitude and "red dot" data is all being computed on-the-fly.

The original images are:

http://chatmusic.com/visual/maps/worldmap.jpg
http://chatmusic.com/visual/maps/continentalus.jpg

The red dots, the long/lat lines, and the AREA tags are all being generated
from PostgreSQL data.

PostgreSQL lets me do some of the AREA tag computations of intersection and
other fun "region" calculations in SQL :-)

I still need to hook in the Radio stations
(http://chatmusic.com/broadcast.htm) with blue dots, and music store
retailers (green dots, of course) and ...  Well, let's just say I've got a
lot of work to do. :-)

Eventually (in glacial time, at the moment) I'm hoping to have a large-scale
OpenContent model of geographic data and data-servers in a distributed
application powered by PHP...

Then anybody on the planet could have complete access to
geographic/zip/street/location data for free.  More importantly,
contributors could upload maps of the area[s] that interest them for a truly
OpenContent distributed paradigm.

Source code is too chaotic to be made public at this time.  Will post
when/if that changes.

Anybody interested in funding this effort is most welcome to email me :-)

NOTE:
Yes, the long/lat are horribly inaccurate as you approach the poles on that
first map.  No, I don't care because:
A) I can swap in a different map that is not logarithmic and change a few db
records when I have time.
B) The whole point is to "zoom in" to more detailed/accurate maps (down to
neighborhood level)
C) The click-able regions are defined independent of the long/lat lines.
D) There just aren't a hell of a lot of music venues at the North/South
pole. :-)

-- 
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: is php free?

2002-07-01 Thread Richard Lynch

In article <[EMAIL PROTECTED]> , [EMAIL PROTECTED]
(Martin Johansson) wrote:

>I am planning to do a webapplication that a company is intrested to use in
>their Intranet.
>To my webapplication I need to use booth PHP and MySQL.
>Does someone know if they really are free, even if I use them in a
>webapplication
>that lately will be sold and installed on the company's webserver.

You'll have to read their licenses, but the short answer is "Yes."

I know it's a scary concept that they'd be free, but they really are.

MySQL (used to?) have some caveats about when it was/wasn't free, but I
think those are gone now...  Read their license to be 100% sure.

PHP is just plain free.

-- 
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: PHP include_path

2002-07-01 Thread Richard Lynch

In article <[EMAIL PROTECTED]> , [EMAIL PROTECTED]
(Tim Nields) wrote:

>I am running php4.2.1.  I tried to use a simple include() coommand, but the
>path that it defaults to is /usr/local/lib/php.  Can anyone tell me how to
>change this?

You might (or might not) be able to edit "php.ini" and alter the
include_path there.

If your ISP doesn't give you your own php.ini file, (most don't) then you
*probably* have permission to use an .htaccess file to do that:

Create a file named ".htaccess" (yes, the '.' at the beginning is for real)
and put a line like this in it:

php_value include_path
"./:/path/to/your/home/directory/:/any/other/directory/you/like"

Note that this syntax is subtly different (php_value) from the php.ini
syntax.

If you have your own server, and edit php.ini, make sure that:

A) You are editing the same php.ini that  says it is
using.
B) You stop/start Apache so the new php.ini is re-loaded.

-- 
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: Why isn't this working?

2002-07-01 Thread Richard Lynch

In article <[EMAIL PROTECTED]> , [EMAIL PROTECTED]
(Jj Harrison) wrote:

>Here is my code:
>
>$query = "UPDATE poll_options SET votes + 1";
>mysql_query($query);
>
>All where conditions have were removed to try and fix the problem

Dunno...

Why aren't you asking the database what went wrong? :-)

mysql_query($query) or die(mysql_error());

Actually, you'd be better off to use:

mysql_query($query) or error_log(mysql_error());

and then check your HTTP error logs, assuming your ISP provides them.

You can leave this error-checking code in there, and always leave a trail
for yourself of what went wrong when where.  Keeping or die() on a
production web-site is a security risk.

Oh, actually, now that I re-read the post, I do know what's wrong in this
case:

update poll_options set VOTES = votes + 1
^^^
This is missing -/

-- 
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: Writing a GIF/JPG Image

2002-07-01 Thread Richard Lynch

In article <[EMAIL PROTECTED]> ,
[EMAIL PROTECTED] (Brandon) wrote:

>I would like to store a jpg/gif image in a MySQL database (as a BLOB type I
>guess ;p), how would I output that into an  in php?

You wouldn't, really.

You would do something like this:



Then, the PHP code in fakeoutbrowser.php would look like:



NOTE:
I *highly* recommend you *NOT* actually do this.  Images will simply clog up
your MySQL database, risk db-corruption, and slow down your MySQL data
transfers to *NO* benefit.

Unless you are the CIA doing high-end image-comparison in SQL to actually
detect if two images "look alike" there's *NO* benefit to cramming your
images into an SQL database.

Far, far better to store them in a high-performance, customized, optimized,
much-used data store commonly known as "the file system" :-)

Just throw the images in a directory (possibly *outside* your web-tree) and
use PHP/MySQL to authorize access, and even use PHP to http://php.net/fread
the file, but not actually cram it into MySQL.


-- 
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: File Upload

2002-07-01 Thread Richard Lynch

In article <[EMAIL PROTECTED]> ,
[EMAIL PROTECTED] (Fgôk ŞôündÉö) wrote:

>In php.ini, upload_max_filesize = 8MB.
>When I try to upload  file over 5MB, my php file didn't work correctly.
>I mean post variable in the php file are lost, session variables also are
>lost ...

Are you 100% sure that you are looking at the correct php.ini?...

What does  say is the upload_max_filesize?

And did you over-ride that with your HTML?  There's a tag that can be used
to decrease (but not increase) the MAX FILE SIZE.

Uploading 5 MB files via HTTP is just a Bad Idea (tm)...

Is there any way to move to FTP?

I suspect there are several other possible sources of error:

Your HTTP server, and any intervening router *IS* allowed to limit the size
of a POST to any value they choose, so long as that value is AT LEAST 1 MB.
(I think.)  While they are all encouraged *NOT* to impose such a limit, they
may.

The user under which PHP is running *MAY* have some kind of shell limit
imposed on their individual temp files or somesuch, I guess...  I mean, I
know there are things like 'ulimit' and 'usage' and so on (see 'man ulimit')
and I reckon somebody somewhere may be bright enough to have come up with a
limitation scheme for the 'nobody' user in the '/tmp' directories...  I
dunno exactly how they might have done that, but it's in the realm of
"possible".

Client configuration -- There may be a buffer and/or Ethernet communication
error that only manifests when you start getting over your 5 MB threshold...
 On both your desktop and on the web-server, do:

ifconfig -a

(I think that's ifconfig /a under Winblows...  Or, no, ipconfig /a  No,
that's not right... Hell, I don't know.  Go ask Bill!)

Anyway, if you do this right before/during/after your upload, and the
"Collision Rate" or "errors" or "overruns" or anything that looks like some
kind of an "error" increases significantly, your Ethernet settings are
probably "wrong" -- They could be "wrong" in a very subtle way involving
TTL, MTU, and other TLA's that I don't really understand, and few people do,
since everybody who tries to 'splain it to me just confuses me.  (So, by
definition, they must not understand it very well, eh? :-)

You may need to do:
whereis ifconfig
just to find out where the heck the program lives...  If it lives in /sbin,
you may need to do:
/sbin/ifconfig -a
to get an answer.
If your ISP is smart, you may not be allowed to even *DO* ifconfig on your
web-server...  If they are that smart, you can maybe assume they have set it
up correctly...  Maybe.

--
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: Incrementing a table cell

2002-07-01 Thread Richard Lynch

In article <[EMAIL PROTECTED]> , [EMAIL PROTECTED]
(Jj Harrison) wrote:

>what is the best way to increment a mySQL table cell?
>
>is there a increment function or do I need to increment it in php?

Do you mean like this:

update myTable set myCell = myCell + 1 where myId = 42

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




  1   2   3   >