php-general Digest 27 Feb 2005 17:11:09 -0000 Issue 3309

2005-02-27 Thread php-general-digest-help

php-general Digest 27 Feb 2005 17:11:09 - Issue 3309

Topics (messages 209527 through 209542):

Re: http referer
209527 by: John Holmes

Uploading a File
209528 by: Jason Bennett
209534 by: Dotan Cohen

Re: Uploading a File Solution
209529 by: Jason Bennett

Re: getting mac id
209530 by: M. Sokolewicz

How to handle actions that may take a long time?
209531 by: Cajus Pollmeier

mcrypt_create_iv always returns same value?
209532 by: Murray . PlanetThoughtful

break/exit
209533 by: timothy johnson
209540 by: Justin Lilly

how to move files from one place to another ?
209535 by: Vaibhav Sibal
209536 by: Burhan Khalid
209538 by: M. Sokolewicz

Re: seach engines that don't suck
209537 by: Burhan Khalid

Re: convert MS DOC - PDF
209539 by: Jochem Maas

Charset and filenames
209541 by: Gustavo Lopes

Upgrade question
209542 by: SurfSafely

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---
Sebastian wrote:
ok, so i made a file manager and i need to prevent people from linking
directly to files that do not come from another part of the site.
i know i can use http_referer, but i wonder how fool proof it is, i dont
want to spit out errors to a legit user that actually came from a valid page
before trying to access the file url. some people have said http_referer is
not always accurate.
I wouldn't rely on http_referer at all. Why not start a session when 
people enter your site and ensure a valid session is created before your 
file manager serves the file?

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
---End Message---
---BeginMessage---
Hi all,

I'm having this problem trying to upload a file using PHP.  I am using
Apache (compiled from source) and PHP 5.0.3

The entire contents of the page is:

form method=post enctype=multipart/form-data action=/upload.php
INPUT TYPE=hidden name=MAX_FILE_SIZE value=52428800
input type=file name=myfile
input type=submit value=Begin Upload
/form


The entire script is:

?php

$uploaddir = /tmp;
$uploadfile = $uploaddir . uploaded.file;

if (move_uploaded_file($_FILES['myfile']['tmp_name'], $uploadfile))
{
  echo Complete.;
}
else
{
   echo No Upload.;
}

?


The returned message I get is:

Notice: Undefined index: myfile in /www/htdocs/upload.php on line 6
No Upload.


I've checked $_FILES['myfile']['error'] and its empty.  The whole
$_FILES array is empty.  In my php.ini file I have the following:


; Whether to allow HTTP file uploads.
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default
if not
; specified).
upload_tmp_dir = /tmp

; Maximum allowed size for uploaded files.
upload_max_filesize = 50M
---End Message---
---BeginMessage---
On Sat, 26 Feb 2005 23:04:59 -0700, Jason Bennett [EMAIL PROTECTED] wrote:
 Hi all,
 
 I'm having this problem trying to upload a file using PHP.  I am using
 Apache (compiled from source) and PHP 5.0.3
 
 The entire contents of the page is:
 
 form method=post enctype=multipart/form-data action=/upload.php
 INPUT TYPE=hidden name=MAX_FILE_SIZE value=52428800
 input type=file name=myfile
 input type=submit value=Begin Upload
 /form
 
 The entire script is:
 
 ?php
 
 $uploaddir = /tmp;
 $uploadfile = $uploaddir . uploaded.file;
 
 if (move_uploaded_file($_FILES['myfile']['tmp_name'], $uploadfile))
 {
  echo Complete.;
 }
 else
 {
   echo No Upload.;
 }
 
 ?
 
 The returned message I get is:
 
 Notice: Undefined index: myfile in /www/htdocs/upload.php on line 6
 No Upload.
 
 I've checked $_FILES['myfile']['error'] and its empty.  The whole
 $_FILES array is empty.  In my php.ini file I have the following:
 
 ; Whether to allow HTTP file uploads.
 file_uploads = On
 
 ; Temporary directory for HTTP uploaded files (will use system default
 if not
 ; specified).
 upload_tmp_dir = /tmp
 
 ; Maximum allowed size for uploaded files.
 upload_max_filesize = 50M
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


You might want to just use my TerribleFile script:
http://dotancohen.com/terriblefile

Even if you don't use it, you can look at the code for ideas. Enjoy.

Dotan Cohen
http://English-Lyrics.com
http://Song-Lyriks.com
---End Message---
---BeginMessage---
Sorry all,

I found the problem.  I had put in an entry in post_max_size as 2G
however PHP seems to think that meant 2 bytes.  I lowered it down to
something reasonable in M and it worked fine.  I'm not sure if that is
a bug or not regardless of whether or not 2G is smart for that variable,
it took it as 2 bytes either way.


Re: [PHP] getting mac id

2005-02-27 Thread M. Sokolewicz
javascript has pretty strict permissions when run via the browser 
itself, so I would say no. Unless you instruct your user to run the 
Javascript via the system itself... but you can't expect that from a 
simple user.

Besides that, a user can choose to turn off JavaScript, or even make it 
run some new JavaScript code specific to that site, with a click of a 
button in most modern browsers, and giving the user the ability to 
completely spoof a part of your control system is never a good idea ;)

- tul
Tyler Replogle wrote:
do you think i could get it with javascript?
From: M. Sokolewicz [EMAIL PROTECTED]
To: php-general@lists.php.net
Subject: Re: [PHP] getting mac id
Date: Sat, 26 Feb 2005 21:15:47 +0100
MIME-Version: 1.0
Received: from lists.php.net ([216.92.131.4]) by MC6-F37.hotmail.com 
with Microsoft SMTPSVC(6.0.3790.211); Sat, 26 Feb 2005 12:16:54 -0800
Received: from ([216.92.131.4:25405] helo=lists.php.net)by 
pb1.pair.com (ecelerity HEAD r(5124)) with SMTPid 58/43-51537-B19D0224 
for [EMAIL PROTECTED]; Sat, 26 Feb 2005 15:16:27 -0500
Received: (qmail 13001 invoked by uid 1010); 26 Feb 2005 20:15:39 -
Received: (qmail 12988 invoked by uid 1010); 26 Feb 2005 20:15:39 -
X-Message-Info: JGTYoYF78jH290JDSHtK0Hwmz4NODmcj7i2AMiICo2M=
Return-Path: [EMAIL PROTECTED]
X-Host-Fingerprint: 216.92.131.4 lists.php.net  Mailing-List: contact 
[EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
list-help: mailto:[EMAIL PROTECTED]
list-unsubscribe: mailto:[EMAIL PROTECTED]
list-post: mailto:php-general@lists.php.net
Delivered-To: mailing list php-general@lists.php.net
Delivered-To: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) 
Gecko/20050106
X-Accept-Language: en-us, en
References: [EMAIL PROTECTED]
[EMAIL PROTECTED] 
[EMAIL PROTECTED]
X-Posted-By: 62.131.2.67
X-OriginalArrivalTime: 26 Feb 2005 20:16:54.0784 (UTC) 
FILETIME=[1D786000:01C51C40]

you can't get the mac-address from a remote (client) computer via PHP 
because PHP is server-sided (server). The mac-address isn't part of 
any sort of standard header the browser sends, thus the server will 
never see it. And if the server can't see it, then PHP can't see it 
either. The only way to get it would be to run a local script which 
would pick it up, and send it over. This however would require 
something like a JAVA applet / application. The mac address is usually 
hidden away quite well so people can't get it and start pretending to 
be someone else. Although the idea is good, it most likely will not be 
possible (relativly easily)

- tul
Lancer Emotion 16 wrote:
But think that not everbody has a computer in his house,especially in
3rd world countries. Here in Peru and in another countries from
Sudamerica,lot of people play this mmorpgs,like Knigths Online,WoW or
Mu,in lan houses. If you ban the pc, none of the users who will play
at this computer will be able to do it.
On Fri, 25 Feb 2005 15:52:02 -0800, Tyler Replogle [EMAIL PROTECTED] 
wrote:

Hey,
I've been on this mailing list for quite a while, but i think this 
is my
first question. I'm not sure though.

Well here goes.
I'm working at this site that has an MMORPG, a big online game, and 
we have
this ban script. it bans the ip for the user and the user acount for an
amount of time. This doesn't seem to be doing its job because people 
just
change there ip and make a new user.

I know there isn't any full way to ban some one from a site, but 
i've been
think and getting the mac id of a computer would work a lot better 
then ip.
I'm not sure how to get teh mac id of a computer though. If any of 
you know
how to can you please tell me. It doesn't just have to be with use 
php we
own the server can we can installl other apps, but many others are 
on the
server anyways.

So how do i get the mac id of a user that is going on to my server?
--
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] How to handle actions that may take a long time?

2005-02-27 Thread Cajus Pollmeier
Hi there,
I'd like to know your opinion about how to handle events that may take 
more than a minute to finish in PHP. In this case,  the code is 
performing a recursive action on a large LDAP tree where I'd like to 
present something like a status page (Please wait, blah blah with 
some animated gif or so), while the action takes place in background.

Is it possible to fork away this PHP code and set some SESSION vars to 
trigger the end of the status page? Or do I have to put this action 
behind a one pixel image and act when the page is really complete? 
Also I'm not sure how to handle the script execution timeout problem...

Any ideas/hints? Some feedback would be appreciated ;-)
Cheers,
Cajus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] mcrypt_create_iv always returns same value?

2005-02-27 Thread Murray @ PlanetThoughtful
Hello All,

 

Just beginning to experiment with encryption using the mcrypt library and
I'm wondering if anyone can tell me if it's normal that the following code
always seems to return exactly the same value whenever executed on my
system:

 

$td =
mcrypt_module_open('rijndael-256','','cbc','');

srand((double) microtime() * 100); 

$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td),
MCRYPT_RAND);

 

I was under the impression that the value in $iv should be different each
time this code is called, but for some reason it isn't?

 

Any help appreciated.

 

Much warmth,

 

Murray

 http://www.planetthoughtful.org/ http://www.planetthoughtful.org

Building a thoughtful planet,

One quirky comment at a time.

 



[PHP] break/exit

2005-02-27 Thread timothy johnson
I have a single php script that I am using to upload my gaim logs to a
mysql server, but I want to put in some type of means to where if that
log was already added then it will exit. what ways would you
recommend?

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



Re: [PHP] Uploading a File

2005-02-27 Thread Dotan Cohen
On Sat, 26 Feb 2005 23:04:59 -0700, Jason Bennett [EMAIL PROTECTED] wrote:
 Hi all,
 
 I'm having this problem trying to upload a file using PHP.  I am using
 Apache (compiled from source) and PHP 5.0.3
 
 The entire contents of the page is:
 
 form method=post enctype=multipart/form-data action=/upload.php
 INPUT TYPE=hidden name=MAX_FILE_SIZE value=52428800
 input type=file name=myfile
 input type=submit value=Begin Upload
 /form
 
 The entire script is:
 
 ?php
 
 $uploaddir = /tmp;
 $uploadfile = $uploaddir . uploaded.file;
 
 if (move_uploaded_file($_FILES['myfile']['tmp_name'], $uploadfile))
 {
  echo Complete.;
 }
 else
 {
   echo No Upload.;
 }
 
 ?
 
 The returned message I get is:
 
 Notice: Undefined index: myfile in /www/htdocs/upload.php on line 6
 No Upload.
 
 I've checked $_FILES['myfile']['error'] and its empty.  The whole
 $_FILES array is empty.  In my php.ini file I have the following:
 
 ; Whether to allow HTTP file uploads.
 file_uploads = On
 
 ; Temporary directory for HTTP uploaded files (will use system default
 if not
 ; specified).
 upload_tmp_dir = /tmp
 
 ; Maximum allowed size for uploaded files.
 upload_max_filesize = 50M
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


You might want to just use my TerribleFile script:
http://dotancohen.com/terriblefile

Even if you don't use it, you can look at the code for ideas. Enjoy.

Dotan Cohen
http://English-Lyrics.com
http://Song-Lyriks.com

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



[PHP] how to move files from one place to another ?

2005-02-27 Thread Vaibhav Sibal
Hello,
Can some please guide me as to how should I move files from one
directory to another on the server itself using PHP ? I use PHP 5.0.3
and Apache2 and Mysql.

Thanks
Vaibhav

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



Re: [PHP] how to move files from one place to another ?

2005-02-27 Thread Burhan Khalid
Vaibhav Sibal wrote:
Hello,
Can some please guide me as to how should I move files from one
directory to another on the server itself using PHP ? I use PHP 5.0.3
and Apache2 and Mysql.
Please, RTFM  http://www.php.net/manual/en/function.copy.php
Please, don't cross post.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] seach engines that don't suck

2005-02-27 Thread Burhan Khalid
Colin Olkowski wrote:
Hi All,
So I've been using my own php to search my site
(http://hiptingle.spydigital.com) and for a while it was fine...But recently
I put in a logging system just to see what people were searching for and
realized they aren't finding what they're seeking.  I wrote all search code
to split words on commas and then builds SQL using LIKE statements (i know,
i know it's bad but i was a newbie when i wrote it).
[ snip ]
Or if there's something totally fly that I don't know about do tell.
http://www.mnogosearch.com -- its fly enough for www.mysql.com, so I 
guess your site would be just fine.

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


[PHP] Re: how to move files from one place to another ?

2005-02-27 Thread M. Sokolewicz
Vaibhav Sibal wrote:
Hello,
Can some please guide me as to how should I move files from one
directory to another on the server itself using PHP ? I use PHP 5.0.3
and Apache2 and Mysql.
Thanks
Vaibhav
http://www.php.net/copy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] convert MS DOC - PDF

2005-02-27 Thread Jochem Maas
mbneto wrote:
Hi,
I have a bunch of M$ WORD documents (rtf and doc) that I'd like to
transform to pdf.
It would simple except that I'd like to allow the user to fill a
couple of variables (name, email, telephone) and replace this before
if generates the pdf.
After searching the net I found some classes but in order to use it
seems that I have to rewrite the entire document and some documents
how do you mean 'rewrite' exactly? if the it takes 3 lines of code
but the PDF is generated twice do you really care too much? (maybe
you have specific speed/thruput requirements?)
have tables/images.
Any tips ?
maybe you can use COM to create a Word object, load the file add some
your vars (possibly inserting them at predetermined bookmarks in the
Word file?) and then generate the PDF?
(maybe you need to save the new Word file first, depending on what tool
you use for the transformation)
alternatively you can open you newly generated pdf file with:
$x = pdf_open_file($pdf, /path/to/pdf/file);
and then modify the file - maybe add a frontpage with a nice logo
and the information taken from the user given variables - you
wouldn't have to make any changes to the originally generated pages.
http://www.zend.com/zend/spotlight/creatingpdfmay1.php?article=creatingpdfmay1kind=slid=273open=1anc=0view=1
http://nl2.php.net/manual/en/ref.pdf.php
-- it might also be possible to create a template pdf that automatically 
displays
some author/doc metadata; then when you generate the PDF you only need to
add the user given variables as metadata and it will display in the file:
PDF_set_info($pdf, author, John Coggeshall);
PDF_set_info($pdf, title, Zend.com Example);
PDF_set_info($pdf, creator, Zend.com);
PDF_set_info($pdf, subject, Code Gallery  Spotlight);
I'm just guessing that its possible to display an author field in the PDF
in similar way to, for Instance, MSWord.
- mb
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] break/exit

2005-02-27 Thread Justin Lilly
how about an if else statement?

-justin


On Sun, 27 Feb 2005 09:55:23 +, timothy johnson
[EMAIL PROTECTED] wrote:
 I have a single php script that I am using to upload my gaim logs to a
 mysql server, but I want to put in some type of means to where if that
 log was already added then it will exit. what ways would you
 recommend?
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Justin Lilly
University of South Carolina

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



[PHP] Charset and filenames

2005-02-27 Thread Gustavo Lopes
Hi
I'm building a script that makes a list of files available in a directory 
(PHP 4.3.10, Apache 2.0.53, windows, NTFS file system). The XHTML is served 
as ISO-8859-1. However, I'm having trouble in generating correct links for 
files with accents, etc.
The problem is rawurlencode() appears to convert strings by translating 
possible url unsafe characters into the corresponding %xx where xx is the 
due hexadecimal number in a specific charset (US-ASCII I think).
Let's say there's a file called:
Anatomia de superfície do tórax.pdf

This file is rawurlencode()'d into:
Anatomia%20de%20superf%EDcie%20do%20t%F3rax.pdf
However, apache rejects this filename, returning a 403 (!) error. In fact, 
the simple ocurrence of, for instance, '%F3' in a url triggers this 
response.

What in fact works (and Apache uses in its mod_autoindex listings) is:
Anatomia%20de%20superf%c3%adcie%20do%20t%c3%b3rax.pdf
Which represents the encoding in UTF-8 (?).

One partial solution would be not to touch the filename and leave the 
encoding to the browsers, which works with IE6 (which leaves the filename 
untouched, apart from the spaces, which are transformed into %20 - apache 
accepts) and Opera7.54 (which surprisingly does the correct encoding), but 
not with Firefox, which performs the same transformation as rawurlencode().

What I need is a function that does the correct enconding, and - since once 
finished I shall move the script to another server - in case there be any 
platform specific issues, a solution that is as universal as possible.

Thanks in advance
Gustavo Lopes 

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



[PHP] Upgrade question

2005-02-27 Thread SurfSafely
Does PHP 4.3.10 have any specific dependencies that might not be found on a
RH Linux 7.1 server currently running PHP 4.0.6?

Please reply to news group only.

P.S. Very disappointed that this newsgroup does not allow posting with
anonymous email addresses. The *INSTANT* I receive my first piece of spam to
this address, I'm history.

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



RE: [PHP] Upgrade question

2005-02-27 Thread Mikey
 Does PHP 4.3.10 have any specific dependencies that might not 
 be found on a RH Linux 7.1 server currently running PHP 4.0.6?

Do you think you could be more descriptive with your problem?  What is
currently failing when you try to build PHP?  Have you looked at the
configure command as shown by phpinfo from your current build to find any
libraries in non-standard places?  Do you have dev versions of the libraries
installed?

 Please reply to news group only.

That is generally what happens with new groups.

 P.S. Very disappointed that this newsgroup does not allow 
 posting with anonymous email addresses. The *INSTANT* I 
 receive my first piece of spam to this address, I'm history.

That will be your loss.

HTH,

Mikey

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



Re: [PHP] Upgrade question

2005-02-27 Thread SurfSafely

Mikey [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
  Does PHP 4.3.10 have any specific dependencies that might not
  be found on a RH Linux 7.1 server currently running PHP 4.0.6?

 Do you think you could be more descriptive with your problem?  What is
 currently failing when you try to build PHP?  Have you looked at the
 configure command as shown by phpinfo from your current build to find any
 libraries in non-standard places?  Do you have dev versions of the
libraries
 installed?

Not having any problem per se. I know that I definitely need to upgrade from
4.0.6. Aps I'm trying to install call for at least 4.2.1. I figure that it's
best to upgrade to the latest of the 4.x series to avoid future hassles. I'm
just always a little concerned about making any upgrades to a mission
critical server and was wondering if anyone has had experience with
upgrading using my specific versions. Server is Rackspace dedicated, Apache
1.3.22. Not sure how you define non-standard for lib locations. They are
clearly shown by phpinfo though. '--libdir=/usr/lib'
'--libexecdir=/usr/libexec' To migrate I would build using all the exact
same settings.

If it fails to install correctly, does it leave the previous version
unaltered?

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



[PHP] // or /**/

2005-02-27 Thread pmpa
Hi all!

This is probably a stupid question, but I have to ask :)
Which takes less processing?

1)
/***/

2)
///

3)
//*

4)
/*
  I'm a noOb
  :)
*/

5)
//
// text
//


Thanks!

Pedro.

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



[PHP] file uploads

2005-02-27 Thread pmpa

I believe you must have
form action=somewhere.php enctype=multipart/form-data method=post


Pedro.

-Mensagem original-
De: Jeremy Freedman [mailto:[EMAIL PROTECTED] 
Enviada: sábado, 26 de Fevereiro de 2005 20:54
Para: php-general@lists.php.net
Assunto: [PHP] file uploads

I got the files to upload correctly using input type=file and associated
php expressions but they seem to be ascii encoded cause the jpgs and gifs
are not displayed at all, just the correct placeholders which means the
getImageSize() function is returning correct data!
Sincerely,

Jeremy Freedman

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



Re: [PHP] // or /**/

2005-02-27 Thread Jochem Maas
pmpa wrote:
Hi all!
This is probably a stupid question, but I have to ask :)
Which takes less processing?
not stupid.
say there is a few microseconds of difference in the parsing/compiling
(in the case of comments the zend engine is more or less stripping
them out as far as 'building a runable script' is concerned -
i.e. comments are executed)
...and your script take 1 second to run, you wil never notice a couple
of microseconds, besides server load would have a much greater effect
on processing time.
whether the comment is 2K or 2bytes will hardly
make a difference I think.
as always: there is a good rule to follow regarding comments:
1. use LOTS
2. try to use 'structured' comments (e.g. comments that are parsable by, for 
instance, phpDoc)
as a 'noob' I wouldn't worry about speed at all, if you
want to worry about something worry about security - a
slow safe script is better than a fast hackable one
besides I remember just struggling to get things done at all
when I first started let alone make my code go fast!
If you are really worried about speed then you should realise that
the running of the script will generally speaking take many factors more
time than the parsing of the script (prior to running). so called
'heavy things' include:
1. creating objects (so much so that if you are creating lots of similar objects
that I find its better to use a factory method that holds a precreated object 
and
clones that on request rather than actually creating a new object each time)
2. calling functions.
but don't worry about it to start with... just get on and write some code!
have fun.
---
if at some stage your collection of scripts become so large. or the load
on your server becomes to great then its probably time to look at a
php accelerator (the idea of which is to precompile your scripts so that you
don't have the compile overhead each time a script is called.). there are a few
different options out there when it comes to accelerators, have a google.
---
...lastly you might want to test how long it take to run. if so search the 
mailing
list archive for a thread entitled : 'PHP Slowness' - it will hopefully give
you some tips regarding rudimentary timing of you scripts.
1)
/***/
2)
///
3)
//*
4)
/*
  I'm a noOb
  :)
*/
5)
//
// text
//
Thanks!
Pedro.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] // or /**/

2005-02-27 Thread Robert Cummings
On Sun, 2005-02-27 at 14:33, pmpa wrote:
 Hi all!
 
 This is probably a stupid question, but I have to ask :)
 Which takes less processing?

Run a test. Regardless though, since the parsing time is so miniscule, I
always use // for comments so that when I want to temporarily comment
out blocks of code I can use /* */ without problem.

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

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



RE: [PHP] // or /**/

2005-02-27 Thread pmpa
Thanks Jochem. You're great!


-Mensagem original-
De: Jochem Maas [mailto:[EMAIL PROTECTED] 
 
pmpa wrote:
 Hi all!
 
 This is probably a stupid question, but I have to ask :)
 Which takes less processing?

not stupid.
say there is a few microseconds of difference in the parsing/compiling

(in the case of comments the zend engine is more or less stripping
them out as far as 'building a runable script' is concerned -
i.e. comments are executed)

...and your script take 1 second to run, you wil never notice a couple
of microseconds, besides server load would have a much greater effect
on processing time.

whether the comment is 2K or 2bytes will hardly
make a difference I think.

as always: there is a good rule to follow regarding comments:

1. use LOTS
2. try to use 'structured' comments (e.g. comments that are parsable by, for
instance, phpDoc)

as a 'noob' I wouldn't worry about speed at all, if you
want to worry about something worry about security - a
slow safe script is better than a fast hackable one
besides I remember just struggling to get things done at all
when I first started let alone make my code go fast!

If you are really worried about speed then you should realise that
the running of the script will generally speaking take many factors more
time than the parsing of the script (prior to running). so called
'heavy things' include:

1. creating objects (so much so that if you are creating lots of similar
objects
that I find its better to use a factory method that holds a precreated
object and
clones that on request rather than actually creating a new object each time)

2. calling functions.

but don't worry about it to start with... just get on and write some code!
have fun.

---

if at some stage your collection of scripts become so large. or the load
on your server becomes to great then its probably time to look at a
php accelerator (the idea of which is to precompile your scripts so that you
don't have the compile overhead each time a script is called.). there are a
few
different options out there when it comes to accelerators, have a google.

---
...lastly you might want to test how long it take to run. if so search the
mailing
list archive for a thread entitled : 'PHP Slowness' - it will hopefully give
you some tips regarding rudimentary timing of you scripts.

 
 1)
 /***/
 
 2)
 ///
 
 3)
 //*
 
 4)
 /*
   I'm a noOb
   :)
 */
 
 5)
 //
 // text
 //
 
 
 Thanks!
 
 Pedro.
 

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



Re: [PHP] // or /**/

2005-02-27 Thread Jochem Maas
pmpa wrote:
Thanks Jochem. You're great!
no. rasmus, for instance, is great. I'm a parrot :-)
but thanks for the compliment.
note to=parrotheadposters
should a parrot respond to a thank you?
/note

-Mensagem original-
De: Jochem Maas [mailto:[EMAIL PROTECTED] 
 
pmpa wrote:

Hi all!
This is probably a stupid question, but I have to ask :)
Which takes less processing?

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


Re: [PHP] Upgrade question

2005-02-27 Thread Vidyut Luther
If you installed PHP from the Redhat RPMs, you may want to see if the
fedoralegacy project has a newer RPM for your distribution.
Otherwise, you're somewhat on your own. What I would do is, run phpinfo,
it will output the configure options used to build PHP, copy those and then
run them on your 4.3.10 directory, you'll know if something breaks, if
it doesn't you'll install like you wanted to.

Technically, since you are at Rackspace, you should be able to tell your
support team to upgrade it for you. I think thats what the managed
part is for.



SurfSafely wrote:

Mikey [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
  

Does PHP 4.3.10 have any specific dependencies that might not
be found on a RH Linux 7.1 server currently running PHP 4.0.6?
  

Do you think you could be more descriptive with your problem?  What is
currently failing when you try to build PHP?  Have you looked at the
configure command as shown by phpinfo from your current build to find any
libraries in non-standard places?  Do you have dev versions of the


libraries
  

installed?



Not having any problem per se. I know that I definitely need to upgrade from
4.0.6. Aps I'm trying to install call for at least 4.2.1. I figure that it's
best to upgrade to the latest of the 4.x series to avoid future hassles. I'm
just always a little concerned about making any upgrades to a mission
critical server and was wondering if anyone has had experience with
upgrading using my specific versions. Server is Rackspace dedicated, Apache
1.3.22. Not sure how you define non-standard for lib locations. They are
clearly shown by phpinfo though. '--libdir=/usr/lib'
'--libexecdir=/usr/libexec' To migrate I would build using all the exact
same settings.

If it fails to install correctly, does it leave the previous version
unaltered?

  


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



Re: [PHP] convert MS DOC - PDF

2005-02-27 Thread mbneto
Hi Jochem,

My system runs on linux so the com part seems to be out.

What I refer as rewrite is that the classes that I saw have some
primitives where I have to call in order to write the text, images and
so on.

Ideally I'd take my word documents, replace the dynamic parts with
special codes so when the user fills the values I'd replace such
occurencies and generate de pdf.


On Sun, 27 Feb 2005 15:14:12 +0100, Jochem Maas [EMAIL PROTECTED] wrote:
 mbneto wrote:
  Hi,
 
  I have a bunch of M$ WORD documents (rtf and doc) that I'd like to
  transform to pdf.
 
  It would simple except that I'd like to allow the user to fill a
  couple of variables (name, email, telephone) and replace this before
  if generates the pdf.
 
  After searching the net I found some classes but in order to use it
  seems that I have to rewrite the entire document and some documents
 
 how do you mean 'rewrite' exactly? if the it takes 3 lines of code
 but the PDF is generated twice do you really care too much? (maybe
 you have specific speed/thruput requirements?)
 
  have tables/images.
 
  Any tips ?
 
 maybe you can use COM to create a Word object, load the file add some
 your vars (possibly inserting them at predetermined bookmarks in the
 Word file?) and then generate the PDF?
 (maybe you need to save the new Word file first, depending on what tool
 you use for the transformation)
 
 alternatively you can open you newly generated pdf file with:
 
 $x = pdf_open_file($pdf, /path/to/pdf/file);
 
 and then modify the file - maybe add a frontpage with a nice logo
 and the information taken from the user given variables - you
 wouldn't have to make any changes to the originally generated pages.
 
 http://www.zend.com/zend/spotlight/creatingpdfmay1.php?article=creatingpdfmay1kind=slid=273open=1anc=0view=1
 http://nl2.php.net/manual/en/ref.pdf.php
 
 -- it might also be possible to create a template pdf that automatically 
 displays
 some author/doc metadata; then when you generate the PDF you only need to
 add the user given variables as metadata and it will display in the file:
 
  PDF_set_info($pdf, author, John Coggeshall);
  PDF_set_info($pdf, title, Zend.com Example);
  PDF_set_info($pdf, creator, Zend.com);
  PDF_set_info($pdf, subject, Code Gallery  Spotlight);
 
 I'm just guessing that its possible to display an author field in the PDF
 in similar way to, for Instance, MSWord.
 
 
  - mb
 
 


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



[PHP] Re: mail() takes a long time to process

2005-02-27 Thread Manuel Lemos
Hello,
on 02/26/2005 09:25 PM Dustin Krysak said the following:
Hi there, I have a script that uses the mail() function, but for some 
reason the script takes a really long time to finish processing (like 5 
minutes). there are some other functions performed (like sql insert, 
etc) that happen immediately as they should. But the mail takes some 
time to finish processing. If I remove the mail function, the script 
finishes immediately. Any ideas? I have included my code below (used for 
the mail). ideas?
Usually this means that the destination server is trying to resolve your 
machine host name from the IP address and it is not possible because the 
DNS misses the respective PTR records. This may happen if you are 
sending messages from domestic (dial-up/ADSL/Cable) Internet account.

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


Re: [PHP] list down

2005-02-27 Thread AdamT
Your email ended up in my gmail spam box.  That should tell you something.


On Fri, 25 Feb 2005 16:04:24 -0800, Tyler Replogle [EMAIL PROTECTED] wrote:
 I think it didn't because i wasn't getting an emails for a while last night.
 I wanted one too becuase i didn't have the email to start a new message.


-- 
AdamT
Justify my text?  I'm sorry, but it has no excuse.

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



[PHP] get_defined_vars in all scopes?

2005-02-27 Thread Anguz
Hi!
I'm using this at the end of a script
echo 'pre'; var_dump(get_defined_vars()); echo '/pre';
but it only returns what get_defined_vars gives, which is what's 
available in the current scope. Is there any way to get also the vars 
used in functions that weren't globalized?

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


[PHP] Mailing List Tool

2005-02-27 Thread GH
Does someone know of a mailing list tool that runs via PHP that can
check periodically (ie via a scheduled task) an email account for a
message and then send it out to an entire list of addresses?

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



Re: [PHP] [NEWBIE] How to allow for a href tags but no others?

2005-02-27 Thread abrea
Dave:
I visited your website. I see that you wish to put the links in the middle 
of the text, which I didn't understand before.
Now, if you let your users write tags you are bound to have a substantial 
number of them who don't even know what 'tag' means, let alone any 
occasional malice.
Perhaps one way to circumvent the problem is to let them write just link1, 
link2, link3 in the textarea, and input the link names and urls 
separately, e.g like this:
!-- STEP 1. INPUT FORM --
form method= post ...
Dear user: Please include link1, link2 ... as placeholders in the text 
and the actual linknames and urls in the boxes below:
textarea ...thetext/textarea
Link1:
Linknameinput type=text name=linkname1 ...
Urlinput type=text name=url1br /
Link2:
Linknameinput type=text name=linkname2 ...
Urlinput type=text name=url2br /
...
Link10:
Linknameinput type=text name=linkname10 ...
Urlinput type=text name=url10br /
/form
// STEP 2 RECEIVE AND VALIDATE THE POSTED VALUES
if(isset($_POST[linkname1])  isset($_POST[url1])
   { // INSERT THE VALUES IN THE DATABASE }
if(isset($_POST[linkname2])  isset($_POST[url2])
   { // INSERT THE VALUES IN THE DATABASE }
...
if(isset($_POST[linkname10])  isset($_POST[url10])
   { // INSERT THE VALUES IN THE DATABASE }
// STEP 3 RETRIEVE (SELECT) THE VALUES FROM THE DB
   $linkname1= thename1; $url1= theurl1;
   $linkname2= thename2; $url2= theurl2;
   ...
   $linkname10= thename10; $url10= theurl10;
// STEP 4 DEFINE THE STRINGS TO BE DISPLAYED WITH A TAGS
   $link1= a href=\$url1\$linkname1/a
   $link2= a href=\$url2\$linkname2/a
   ...
   $link10= a href=\$url10\$linkname10/a
   // SUBSTITUTE THE NEW VARS INSTEAD OF THE PLACEHOLDERS
   $thetext= This is the text to be shown;
   $thetext.= substr(link1, $link1)ETC; // CHECK SYNTAX
   // THE TEXT WITH THE LINKS INCLUDED
   $thetext= This is the text to be shown, which includes $link1 .
  and then $link2 and last but not least $link10 .
  Blah Blah Blah.;
?
!-- STEP 5 WRITE THE DISPLAY --
img src=thephoto.jpg
The text to be shown, with the included links, is this: ?=$thetext?
Hope this helps.
Alberto Brea

-Original Message-
From: Dave [EMAIL PROTECTED]
To: php-general@lists.php.net
Date: Sat, 26 Feb 2005 12:27:04 +0900
Subject: Re: [PHP] [NEWBIE] How to allow for a href tags but no others?

 Alberto, John, Jochem, Richard, Tyler,
 
 Thank you for your very helpful advice. So far I'm thinking of 
 definitely including some of Tyler's code for doing some filtering, 
 along with the other commands mentioned, like strip_tags() for securing
 the input.
 
 However, I would like to ask further about what Alberto was talking
 about in terms of storing the url separately. Someone mentioned that 
 Chris suggested making my own syntax, but I somehow the response from
 Chris didn't get to me, so I'm not sure what that implies.
 
 Without a doubt, it would be better to save the URL separately, and
 then refuse any other user attempts at hand coded HTML. But the problem
 that I can't quite resolve is how to get separately stored URLs into 
 inline text in such a way that a non-HTML literate user could handle.
 Right now I offer the user the option of saving a web link with a 
 title separately from the block of text. They can create a user profile
 which looks like this:
 http://www.tokyocomedy.com/people.php?person=7   (Page has Japanese
 text)
 But that's not quite satisfactory. I'm trying to give people the 
 option of having profiles that look like this:
 http://www.tokyocomedy.com/people.php?person=11   (Page has
 Japanese 
 text)
 
I can set up the form for users to input multiple URLs, but how can
 I 
 then allow them to place them in the desired location in their text?
 
 -- 
 Dave Gutteridge
 [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] getting mac id

2005-02-27 Thread Tyler Replogle
Yeah i wasn't think. I've already ruled that out i guess i'll have to 
use java.

From: M. Sokolewicz [EMAIL PROTECTED]
To: php-general@lists.php.net
Subject: Re: [PHP] getting mac id
Date: Sun, 27 Feb 2005 09:29:41 +0100
MIME-Version: 1.0
Received: from lists.php.net ([216.92.131.4]) by mc4-f19.hotmail.com with 
Microsoft SMTPSVC(6.0.3790.211); Sun, 27 Feb 2005 00:31:17 -0800
Received: from ([216.92.131.4:7256] helo=lists.php.net)by pb1.pair.com 
(ecelerity HEAD r(5124)) with SMTPid A6/B7-43672-82581224 for 
[EMAIL PROTECTED]; Sun, 27 Feb 2005 03:30:38 -0500
Received: (qmail 24721 invoked by uid 1010); 27 Feb 2005 08:29:32 -
Received: (qmail 24706 invoked by uid 1010); 27 Feb 2005 08:29:32 -
X-Message-Info: JGTYoYF78jEHjJx36Oi8+Z3TmmkSEdPtfpLB7P/ybN8=
Return-Path: [EMAIL PROTECTED]
X-Host-Fingerprint: 216.92.131.4 lists.php.net  Mailing-List: contact 
[EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
list-help: mailto:[EMAIL PROTECTED]
list-unsubscribe: mailto:[EMAIL PROTECTED]
list-post: mailto:php-general@lists.php.net
Delivered-To: mailing list php-general@lists.php.net
Delivered-To: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) 
Gecko/20050106
X-Accept-Language: en-us, en
References: [EMAIL PROTECTED] 
[EMAIL PROTECTED]
X-Posted-By: 62.131.2.67
X-OriginalArrivalTime: 27 Feb 2005 08:31:18.0398 (UTC) 
FILETIME=[B56E49E0:01C51CA6]

javascript has pretty strict permissions when run via the browser itself, 
so I would say no. Unless you instruct your user to run the Javascript via 
the system itself... but you can't expect that from a simple user.

Besides that, a user can choose to turn off JavaScript, or even make it run 
some new JavaScript code specific to that site, with a click of a button in 
most modern browsers, and giving the user the ability to completely spoof a 
part of your control system is never a good idea ;)

- tul
Tyler Replogle wrote:
do you think i could get it with javascript?
From: M. Sokolewicz [EMAIL PROTECTED]
To: php-general@lists.php.net
Subject: Re: [PHP] getting mac id
Date: Sat, 26 Feb 2005 21:15:47 +0100
MIME-Version: 1.0
Received: from lists.php.net ([216.92.131.4]) by MC6-F37.hotmail.com with 
Microsoft SMTPSVC(6.0.3790.211); Sat, 26 Feb 2005 12:16:54 -0800
Received: from ([216.92.131.4:25405] helo=lists.php.net)by pb1.pair.com 
(ecelerity HEAD r(5124)) with SMTPid 58/43-51537-B19D0224 for 
[EMAIL PROTECTED]; Sat, 26 Feb 2005 15:16:27 -0500
Received: (qmail 13001 invoked by uid 1010); 26 Feb 2005 20:15:39 -
Received: (qmail 12988 invoked by uid 1010); 26 Feb 2005 20:15:39 -
X-Message-Info: JGTYoYF78jH290JDSHtK0Hwmz4NODmcj7i2AMiICo2M=
Return-Path: [EMAIL PROTECTED]
X-Host-Fingerprint: 216.92.131.4 lists.php.net  Mailing-List: contact 
[EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
list-help: mailto:[EMAIL PROTECTED]
list-unsubscribe: mailto:[EMAIL PROTECTED]
list-post: mailto:php-general@lists.php.net
Delivered-To: mailing list php-general@lists.php.net
Delivered-To: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) 
Gecko/20050106
X-Accept-Language: en-us, en
References: [EMAIL PROTECTED]
[EMAIL PROTECTED] 
[EMAIL PROTECTED]
X-Posted-By: 62.131.2.67
X-OriginalArrivalTime: 26 Feb 2005 20:16:54.0784 (UTC) 
FILETIME=[1D786000:01C51C40]

you can't get the mac-address from a remote (client) computer via PHP 
because PHP is server-sided (server). The mac-address isn't part of any 
sort of standard header the browser sends, thus the server will never see 
it. And if the server can't see it, then PHP can't see it either. The 
only way to get it would be to run a local script which would pick it up, 
and send it over. This however would require something like a JAVA applet 
/ application. The mac address is usually hidden away quite well so 
people can't get it and start pretending to be someone else. Although the 
idea is good, it most likely will not be possible (relativly easily)

- tul
Lancer Emotion 16 wrote:
But think that not everbody has a computer in his house,especially in
3rd world countries. Here in Peru and in another countries from
Sudamerica,lot of people play this mmorpgs,like Knigths Online,WoW or
Mu,in lan houses. If you ban the pc, none of the users who will play
at this computer will be able to do it.
On Fri, 25 Feb 2005 15:52:02 -0800, Tyler Replogle [EMAIL PROTECTED] 
wrote:

Hey,
I've been on this mailing list for quite a while, but i think this is 
my
first question. I'm not sure though.

Well here goes.
I'm working at this site that has an MMORPG, a big online game, and we 
have
this ban script. it bans the ip for the user and the user acount for an
amount of time. This doesn't seem to be doing its job because people 
just
change there ip and make a new user.

I know there isn't any full way to ban some one from a site, but i've 
been
think and getting the mac id of a computer would work a 

Re: [PHP] get_defined_vars in all scopes?

2005-02-27 Thread John Holmes
 I'm using this at the end of a script
 
 echo 'pre'; var_dump(get_defined_vars()); echo '/pre';
 
 but it only returns what get_defined_vars gives, which is what's 
 available in the current scope. Is there any way to get also the vars 
 used in functions that weren't globalized?

No, not unless you call this in the functions, also. The variables don't exist 
after the function is completed. 

---John Holmes...

UCCASS - PHP Survey System
http://www.bigredspark.com/survey.html

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



Re: [PHP] Was: Putting Evaluated Contents...

2005-02-27 Thread Marek Kilimajer
Brian A. Anderson wrote:
Hey,
Now, how about taking that variable and executing it? How might one do this?
For instance:
I  might have an asp page on one server(Yeah, I have to use asp on that
server) generate the results in the form of a bit of php code, and pass it
to my php script via include method for execution. When the php page gets
the results I could execute this? Would I have to put the ob_start()...
ob_get_clean();  within a function? How would I execute it?
I am thinking of this way as my php pages use a templating system, and I
would like to take the data from the asp results and shoot them into my
template object for rendering.

include('http://winserver/page.asp');
will execute php code generated by asp
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Javascript PHP

2005-02-27 Thread timothy johnson
I am trying to make a small menu system using javascript, but the
values that I want to use come from php/mysql. I can get the code to
work when I type in the values but when I try to use php. it doesnt
process the php. you view source and you can see the php functions. I
have tried naming the file different types like php, html,
js.phpnothing is working. How can I use php to output javascript
vars?

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




Re: [PHP] Uploading a File

2005-02-27 Thread anirudh dutt
were those two sections in the same file? entire contents and
entire script can be a bit unclear. if they are in the same file...

u might want to put an
if (!empty($_FILES['myfile']['name'])) {
//second section that handles files upload
// the $uploaddir = /tmp; part
}

it would be good to give ur submit button a name:
input type=submit name=submit_button_name value=Begin Upload
...so u can use it as
if (isset($_POST['submit_button_name'])) {
// 2nd section as above
}


On Sat, 26 Feb 2005 23:04:59 -0700, Jason Bennett [EMAIL PROTECTED] wrote:
 Hi all,
 
 I'm having this problem trying to upload a file using PHP.  I am using
 Apache (compiled from source) and PHP 5.0.3
 
 The entire contents of the page is:
 
 form method=post enctype=multipart/form-data action=/upload.php
 INPUT TYPE=hidden name=MAX_FILE_SIZE value=52428800
 input type=file name=myfile
 input type=submit value=Begin Upload
 /form
 
 The entire script is:
 
 ?php
 
 $uploaddir = /tmp;
 $uploadfile = $uploaddir . uploaded.file;
 
 if (move_uploaded_file($_FILES['myfile']['tmp_name'], $uploadfile))
 {
   echo Complete.;
 }
 else
 {
echo No Upload.;
 }
 
 ?
 
 The returned message I get is:
 
 Notice: Undefined index: myfile in /www/htdocs/upload.php on line 6
 No Upload.
 
 I've checked $_FILES['myfile']['error'] and its empty.  The whole
 $_FILES array is empty.  In my php.ini file I have the following:
 
 ; Whether to allow HTTP file uploads.
 file_uploads = On
 
 ; Temporary directory for HTTP uploaded files (will use system default
 if not
 ; specified).
 upload_tmp_dir = /tmp
 
 ; Maximum allowed size for uploaded files.
 upload_max_filesize = 50M
 

-- 
]#
Anirudh Dutt


...pilot of the storm who leaves no trace
like thoughts inside a dream

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



Re: [PHP] Javascript PHP

2005-02-27 Thread anirudh dutt
use php to output the javascript code just as u'd do it for html
(since the javascript code is IN the html).
if ur js is ready:
?php
echo JS_TEXT
script language=javascript!--
...
//--/script
JS_TEXT;
?
the script part could be the code or a link to the file which u'd use as
link rel=...

[some trivial stuff]
u can do this even if the javascript section is dynamic...u've used
variables in such a way that u repeat code for each section in the
page and the number of sections is dynamic.
[/some trivial stuff]

On Mon, 28 Feb 2005 01:18:15 +, timothy johnson
[EMAIL PROTECTED] wrote:
 I am trying to make a small menu system using javascript, but the
 values that I want to use come from php/mysql. I can get the code to
 work when I type in the values but when I try to use php. it doesnt
 process the php. you view source and you can see the php functions. I
 have tried naming the file different types like php, html,
 js.phpnothing is working. How can I use php to output javascript
 vars?
 

-- 
]#
Anirudh Dutt


...pilot of the storm who leaves no trace
like thoughts inside a dream

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



Re: [PHP] get_defined_vars in all scopes?

2005-02-27 Thread Anguz
John Holmes wrote:
I'm using this at the end of a script
echo 'pre'; var_dump(get_defined_vars()); echo '/pre';
but it only returns what get_defined_vars gives, which is what's 
available in the current scope. Is there any way to get also the vars 
used in functions that weren't globalized?

No, not unless you call this in the functions, also. The variables don't exist after the function is completed. 

---John Holmes...
UCCASS - PHP Survey System
http://www.bigredspark.com/survey.html
I see. Thank you John.
Many functions may end at different places, they not alway reach the 
end, so I guess I could do it globalizing every var/arr, at least the 
ones I'm most interested in.

Is there some program I can use that'll monitor the vars when executing 
the script? I think Xdebug [http://xdebug.org/] does that with 
functions, but am not sure if it'll work with vars.

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


Re: [PHP] getting mac id

2005-02-27 Thread anirudh dutt
On Fri, 25 Feb 2005 15:52:02 -0800, Tyler Replogle [EMAIL PROTECTED] wrote:
 Hey,
 
 I've been on this mailing list for quite a while, but i think this is my
 first question. I'm not sure though.
 

congrats on managing not to exceed ur account limit ;-)
especially since u've been on this mailing list for quite a while

-- 
]#
Anirudh Dutt


...pilot of the storm who leaves no trace
like thoughts inside a dream

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



[PHP] Getting PHP to work with MySQL 4.1.10 under Fedora Core 3

2005-02-27 Thread John Swartzentruber
I have installed MySQL 4.1.10 from RPMs from MySQL. I have installed PHP 
5.0.3 from source and specified --with-mysql=shared,/usr on the 
configure line. Things seem to build and load correctly, but (after 
restarting Apache) when I try to run phpMyAdmin, I get the following error:

cannot load mysql extension,
please check PHP Configuration
Documentation
I looked at the documentation and I understand what it is saying, but I 
don't understand why it isn't able to load the mysql.so file.

I'm a real newbie who wants to learn PHP and MySQL and doesn't know 
either of them very much yet. I would greatly appreciate it if someone 
could look at my phpInfo() output and point out anything I am missing. 
You can see it at:

http://john.swartzentruber.us/test.php
I copied the mysql.so file from /usr/local/src/php-5.0.3/modules/ to 
/usr/lib/httpd/modules/. I'm running Apache 2.0.52 from the Fedora RPM.

I appreciate any help anyone can provide.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Upgrade question

2005-02-27 Thread SurfSafely
Rackspace will only support 7.1 up to the point where RPMs hit eol.
Translation: They stopped supporting 7.1. Because Rackspace donates the
server for SurfSafely.com, telling my support team would be a bit harsh.
Asking is what I do and they're still deliberating. While they deliberate,
here is what I discovered.

Running ./configure with the original options from phpinfo, I ran into three
dependencies, ONE AT A TIME.  1) For some reason it couldn't find BZip2 even
though support for it is enabled. Upgraded to 1.0.2.  2) ./configure again
and it reported it needs cURL 7.9.8 or higher. Mine was 7.8.0 so I upgraded
to 7.13.0.  3) Lastly it wanted to see pspell. Again, .11.1 was already
installed and enabled but configure couldn't see it at all. I upgraded to
.12.2.

This time success upgrading to PHP 4.3.10!  Full stop then start to Apache,
eh voi la!

Now I can finally move on to *WHY* I needed the PHP upgrade in the first
place, to upgrade other software packages that wouldn't budge without it.
Aren't dependencies fun?

Thanks to all who responded.

Vidyut Luther wrote in message news:[EMAIL PROTECTED]
 If you installed PHP from the Redhat RPMs, you may want to see if the
 fedoralegacy project has a newer RPM for your distribution.
 Otherwise, you're somewhat on your own. What I would do is, run phpinfo,
 it will output the configure options used to build PHP, copy those and
then
 run them on your 4.3.10 directory, you'll know if something breaks, if
 it doesn't you'll install like you wanted to.

 Technically, since you are at Rackspace, you should be able to tell your
 support team to upgrade it for you. I think thats what the managed
 part is for.



 SurfSafely wrote:

 Mikey wrote in message
 news:[EMAIL PROTECTED]
 
 
 Does PHP 4.3.10 have any specific dependencies that might not
 be found on a RH Linux 7.1 server currently running PHP 4.0.6?
 
 
 Do you think you could be more descriptive with your problem?  What is
 currently failing when you try to build PHP?  Have you looked at the
 configure command as shown by phpinfo from your current build to find
any
 libraries in non-standard places?  Do you have dev versions of the
 
 
 libraries
 
 
 installed?
 
 
 
 Not having any problem per se. I know that I definitely need to upgrade
from
 4.0.6. Aps I'm trying to install call for at least 4.2.1. I figure that
it's
 best to upgrade to the latest of the 4.x series to avoid future hassles.
I'm
 just always a little concerned about making any upgrades to a mission
 critical server and was wondering if anyone has had experience with
 upgrading using my specific versions. Server is Rackspace dedicated,
Apache
 1.3.22. Not sure how you define non-standard for lib locations. They
are
 clearly shown by phpinfo though. '--libdir=/usr/lib'
 '--libexecdir=/usr/libexec' To migrate I would build using all the exact
 same settings.
 
 If it fails to install correctly, does it leave the previous version
 unaltered?
 
 
 

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



[PHP] How to retrieve form data?

2005-02-27 Thread Gregg Nelson
The first execution of the file below produces the expected output:
Request Method: GET

Clicking on the Submit button outputs:
Request Method: POST
$_POST array contains:
Array

Why don't I see one of the values from the select item?

---
html
form action=?php $_SERVER['PHP_SELF'] ? method=post 
   select name=item 
 option value=select item 1  item 1 /option
 option value=select item 2  item 2 /option
   /select
input type=submit value=Submit
/form

?php
echo Request Method: .$_SERVER['REQUEST_METHOD'].br /;

if ($_SERVER['REQUEST_METHOD'] == POST):
   echo '$_POST array contains:'.br /;
   foreach ($_POST as $value) {echo $value.br /;}
endif;
?/html

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



Re: [PHP] How to retrieve form data?

2005-02-27 Thread John Nichel
Gregg Nelson wrote:
The first execution of the file below produces the expected output:
Request Method: GET
Clicking on the Submit button outputs:
Request Method: POST
$_POST array contains:
Array
Why don't I see one of the values from the select item?

---
html
form action=?php $_SERVER['PHP_SELF'] ? method=post 
   select name=item 
 option value=select item 1  item 1 /option
 option value=select item 2  item 2 /option
   /select
input type=submit value=Submit
/form
?php
echo Request Method: .$_SERVER['REQUEST_METHOD'].br /;
if ($_SERVER['REQUEST_METHOD'] == POST):
   echo '$_POST array contains:'.br /;
   foreach ($_POST as $value) {echo $value.br /;}
endif;
?/html
Your foreach loop isn't going to print what _you're_ expecting.
foreach ( $_POST as $key = $value ) {
echo ( $value . br / );
}
but print_r() would be much easier...
echo ( pre );
print_r ( $_POST );
echo ( /pre );
--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How to retrieve form data?

2005-02-27 Thread Gregg Nelson
Thank you for your very quick answer. As you may have already guessed,  I'm
new to PHP, and struggling with the the most basic operations.

I modifed the 'echo' as suggested and also added a 'printr statement.
The modified portion of the script is below

if ($_SERVER['REQUEST_METHOD'] == POST):
   echo 'Using foreach loop, $_POST array contains:'.br /;
   foreach ( $_POST as $key = $value ) { echo ( $value . br / );}
   echo 'Using printr, $_POST array contains:'.br /;
echo ( pre );
print_r ( $_POST );
echo ( /pre );
endif;

Clicking on the submit button now produces:
--
Request Method: POST
Using foreach loop, $_POST array contains:
Array
Using printr, $_POST array contains:

Array
(
[item] = Array
(
[0] = select item 1
)

)
-So what exactly does this
mean?:  $Post is an array thatconsists of one item that is also an array,
that being the item array consisting of one entry containing the select
string?If so, can I access the item array itself? I tried this in the
script but nothing was echoed:echo $item[0]
John Nichel [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Gregg Nelson wrote:
  The first execution of the file below produces the expected output:
  Request Method: GET
 
  Clicking on the Submit button outputs:
  Request Method: POST
  $_POST array contains:
  Array
 
  Why don't I see one of the values from the select item?

 --
--
  ---
  html
  form action=?php $_SERVER['PHP_SELF'] ? method=post 
 select name=item 
   option value=select item 1  item 1 /option
   option value=select item 2  item 2 /option
 /select
  input type=submit value=Submit
  /form
 
  ?php
  echo Request Method: .$_SERVER['REQUEST_METHOD'].br /;
 
  if ($_SERVER['REQUEST_METHOD'] == POST):
 echo '$_POST array contains:'.br /;
 foreach ($_POST as $value) {echo $value.br /;}
  endif;
  ?/html

 Your foreach loop isn't going to print what _you're_ expecting.

 foreach ( $_POST as $key = $value ) {
 echo ( $value . br / );
 }

 but print_r() would be much easier...

 echo ( pre );
 print_r ( $_POST );
 echo ( /pre );

 -- 
 By-Tor.com
 ...it's all about the Rush
 http://www.by-tor.com

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



[PHP] Hmmm

2005-02-27 Thread Jason Bennett
I just installed a new MYSQL version 4.1 (from 4.0) and now none of my
PHP scripts work anymore.  They are all complaining about attempting to
login as root.  Normally, I referance a class like:

 

class DB

{

  function DB()

  {

$this-host = 127.0.0.1:3306;

$this-db = mydatabase;

$this-user = reader;

$this-pass = read123;

$this-link = mysql_connect($this-host, $this-user, $this-pass);

mysql_select_db($this-db);

 

  }

}

 

 

Now it seems it just doesn't want to work anymore.  They all worked
great on the old MySQL.

 

Does anyone have any ideas what I might have missed?

 

Thanks!

 

J.

 



Re: [PHP] Hmmm

2005-02-27 Thread John Nichel
Jason Bennett wrote:
I just installed a new MYSQL version 4.1 (from 4.0) and now none of my
PHP scripts work anymore.  They are all complaining about attempting to
login as root.
snip
I'm going to guess that you didn't setup MySQL 4.1 to accept 'old-style' 
passwords.

--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How to retrieve form data?

2005-02-27 Thread John Nichel
Gregg Nelson wrote:
snip
Clicking on the submit button now produces:
--
Request Method: POST
Using foreach loop, $_POST array contains:
Array
Using printr, $_POST array contains:
Array
(
[item] = Array
(
[0] = select item 1
)
)
-So what exactly does this
mean?:  $Post is an array thatconsists of one item that is also an array,
that being the item array consisting of one entry containing the select
string?If so, can I access the item array itself? I tried this in the
script but nothing was echoed:echo $item[0]
No, that's not how it should be coming across.  Not unless you modified 
your original form to send item as an array (like you would do if it was 
a multi-select).  If your HTML form hasn't changed from how you have it 
below, and 'item' is still coming across as an array, you have a problem 
sowhere else.

original form?
---
html
form action=?php $_SERVER['PHP_SELF'] ? method=post 
  select name=item 
option value=select item 1  item 1 /option
option value=select item 2  item 2 /option
  /select
input type=submit value=Submit
/form
?php
echo Request Method: .$_SERVER['REQUEST_METHOD'].br /;
if ($_SERVER['REQUEST_METHOD'] == POST):
  echo '$_POST array contains:'.br /;
  foreach ($_POST as $value) {echo $value.br /;}
endif;
?/html
--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Hmmm

2005-02-27 Thread Jason Bennett
Oooo.. good one.  I used the RPM install for MySQL.. can you point me in
the right direction for doing this?

Thanks!!

J.

-Original Message-
From: John Nichel [mailto:[EMAIL PROTECTED] 
Sent: Sunday, February 27, 2005 9:40 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Hmmm

Jason Bennett wrote:
 I just installed a new MYSQL version 4.1 (from 4.0) and now none of my
 PHP scripts work anymore.  They are all complaining about attempting
to
 login as root.
snip

I'm going to guess that you didn't setup MySQL 4.1 to accept 'old-style'

passwords.

-- 
By-Tor.com
...it's all about the Rush
http://www.by-tor.com

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

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



Re: [PHP] Hmmm

2005-02-27 Thread John Nichel
Jason Bennett wrote:
Oooo.. good one.  I used the RPM install for MySQL.. can you point me in
the right direction for doing this?
Thanks!!
J.
Google is your friend...
http://www.google.com/search?q=mysql+4.1+accept+old+password
--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Getting PHP to work with MySQL 4.1.10 under Fedora Core 3

2005-02-27 Thread M. Sokolewicz
well, for some reason it didn't compile in the mysql extension at all... 
even though it was configured to. That's strange, and I have no idea why 
it would do that. However, since you're using mysql 4.1.x, you should be 
using the mysqli interface anyway. Even phpmyadmin has the option to use 
mysqli instead of mysql; you just need to configure it that way (via 
config.inc.php)

- tul
John Swartzentruber wrote:
I have installed MySQL 4.1.10 from RPMs from MySQL. I have installed PHP 
5.0.3 from source and specified --with-mysql=shared,/usr on the 
configure line. Things seem to build and load correctly, but (after 
restarting Apache) when I try to run phpMyAdmin, I get the following error:

cannot load mysql extension,
please check PHP Configuration
Documentation
I looked at the documentation and I understand what it is saying, but I 
don't understand why it isn't able to load the mysql.so file.

I'm a real newbie who wants to learn PHP and MySQL and doesn't know 
either of them very much yet. I would greatly appreciate it if someone 
could look at my phpInfo() output and point out anything I am missing. 
You can see it at:

http://john.swartzentruber.us/test.php
I copied the mysql.so file from /usr/local/src/php-5.0.3/modules/ to 
/usr/lib/httpd/modules/. I'm running Apache 2.0.52 from the Fedora RPM.

I appreciate any help anyone can provide.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php