php-general Digest 27 Feb 2005 17:11:09 -0000 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


----------------------------------------------------------------------
--- Begin Message --- 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 ---
--- Begin Message ---
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 ---
--- Begin Message ---
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 ---
--- Begin Message ---
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.

Cheers,

J.


-----Original Message-----
From: Jason Bennett [mailto:[EMAIL PROTECTED] 
Sent: Saturday, February 26, 2005 11:05 PM
To: php-general@lists.php.net
Subject: [PHP] Uploading a File

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

--- End Message ---
--- Begin Message --- 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 -0000
Received: (qmail 12988 invoked by uid 1010); 26 Feb 2005 20:15:39 -0000
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


--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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() * 1000000); 

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

 


--- End Message ---
--- Begin Message ---
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?

--- End Message ---
--- Begin Message ---
how about an if else statement?

-justin


On Sun, 27 Feb 2005 09:55:23 +0000, 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

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message --- 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.

--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message --- 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.

--- End Message ---
--- Begin Message --- 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=creatingpdfmay1&kind=sl&id=273&open=1&anc=0&view=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


--- End Message ---
--- Begin Message ---
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 

--- End Message ---
--- Begin Message ---
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.

--- End Message ---

Reply via email to