php-general Digest 2 Mar 2003 04:34:21 -0000 Issue 1913

Topics (messages 137695 through 137752):

Re: Constants and "Here Document" Interpolation
        137695 by: Danny Shepherd
        137707 by: Ernest E Vogelsinger
        137708 by: Daniel R. Hansen
        137722 by: Ernest E Vogelsinger

Re: email pipe
        137696 by: Michael Sims

Re: Get variable from PHP before submit
        137697 by: Rich Gray

Re: Creating MySQL Entry Forms
        137698 by: Bobby Patel

Re: Parse exec output
        137699 by: Rich Gray

Re: php.ini
        137700 by: Rich Gray
        137727 by: Anthony Ritter
        137728 by: Anthony Ritter
        137732 by: Rich Gray

Re: mysql replication + mysql_pconnect
        137701 by: Rich Gray

Re: Random not working?
        137702 by: Rich Gray

Re: [PHP-DB] RE: [PHP] Random not working?
        137703 by: Frank Keessen
        137704 by: Dennis Cole

Re: [PHP-DB] Making Join
        137705 by: Daniel Harik
        137706 by: Daniel Harik

Re: Mysql Date got prob!
        137709 by: Dhaval Desai

Checking Access to a directory Via a PHP/MYSQL Databace.
        137710 by: Philip J. Newman
        137723 by: Ernest E Vogelsinger

Re: .htpasswd and PayPal generated passwords
        137711 by: Boaz Yahav

Using PHP to convert to JPEG
        137712 by: Jason Paschal

Re: Restate: using php to rotate ad banners
        137713 by: Joseph Bannon
        137714 by: Joseph Bannon
        137715 by: Joseph Bannon

2 questions !
        137716 by: Vincent M.
        137719 by: Greg Beaver

Stream file content to the web (possibly OT)
        137717 by: Reuben D. Budiardja

Downloading via FTP in parts
        137718 by: Siddharth

Upper and lower case.
        137720 by: Philip J. Newman
        137721 by: Philip J. Newman
        137738 by: John W. Holmes

Calendar
        137724 by: Jason D. Williard
        137726 by: Darren Young

More Apache than PHP
        137725 by: Timothy Hitchens \(HiTCHO\)
        137748 by: Jason Sheets

A few questions...
        137729 by: The Head Sage
        137730 by: Ernest E Vogelsinger

Re: Checking for HTTP:// at the start of a string and more ////
        137731 by: Kris Jones
        137734 by: Ernest E Vogelsinger

stripslashes()
        137733 by: Dade Register
        137735 by: Ernest E Vogelsinger
        137736 by: Dade Register
        137737 by: Ernest E Vogelsinger
        137743 by: Dade Register
        137745 by: Ernest E Vogelsinger
        137746 by: Dade Register
        137747 by: Ernest E Vogelsinger

Re: PHP Project for a newbie (me) or for hire?
        137739 by: David T-G

Garbage at beginning of uploaded Text File
        137740 by: Monty
        137741 by: John W. Holmes
        137744 by: Monty

Fusebox & PHP 4.3.1 on AIX
        137742 by: CDitty

A JS problem
        137749 by: Dade Register
        137750 by: John W. Holmes

PHP scripts and the GPL/other licenses
        137751 by: Jeff Lewis
        137752 by: Leif K-Brooks

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:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Hello,

It doesn't look like it - a note in the constants manual entry reads:

"PHP has no way of recognizing the constant from any other string of
characters within the heredoc block"

Danny.

-----Original Message-----
From: Daniel R. Hansen [mailto:[EMAIL PROTECTED] 
Sent: 01 March 2003 15:57
To: [EMAIL PROTECTED]

Can anyone tell me if it is possible (and how) to use defined constants
within "here document" content?  I've not been successful finding anything
on this in the online docs.

Thanks!

Dan




--- End Message ---
--- Begin Message ---
At 16:56 01.03.2003, Daniel R. Hansen said:
--------------------[snip]--------------------
>Can anyone tell me if it is possible (and how) to use defined constants
>within "here document" content?  I've not been successful finding anything
>on this in the online docs.
--------------------[snip]-------------------- 

You simply could have tried it - it's trivial.

The answer: no, you cannot have a constant within a string, be it heredoc
or quoted. A constant must always reside on "native code level".

However you can easily concatenate strings and heredocs - both of the
examples below work correctly:

define('A_CONSTANT', 1);
$text1 = <<<EOT
This heredoc text contains the constant A_CONSTANT (
EOT
. A_CONSTANT . <<< EOT
) outside the heredoc construct...
EOT;

$text2 = "This quoted text contains the constant A_CONSTANT (" .
         A_CONSTANT .
         ") outside the string quotes...";
echo "$text1<br />$text2";

Output:
This heredoc text contains the constant A_CONSTANT (1) outside the heredoc
construct...
This quoted text contains the constant A_CONSTANT (1) outside the string
quotes...


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



--- End Message ---
--- Begin Message ---
Actually I did try it and couldn't think of a way to work around the matter.
Thanks for the suggestion.

-----Original Message-----
From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 01, 2003 12:56 PM
To: Daniel R. Hansen
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Constants and "Here Document" Interpolation


At 16:56 01.03.2003, Daniel R. Hansen said:
--------------------[snip]--------------------
>Can anyone tell me if it is possible (and how) to use defined constants
>within "here document" content?  I've not been successful finding anything
>on this in the online docs.
--------------------[snip]--------------------

You simply could have tried it - it's trivial.

The answer: no, you cannot have a constant within a string, be it heredoc
or quoted. A constant must always reside on "native code level".

However you can easily concatenate strings and heredocs - both of the
examples below work correctly:

define('A_CONSTANT', 1);
$text1 = <<<EOT
This heredoc text contains the constant A_CONSTANT (
EOT
. A_CONSTANT . <<< EOT
) outside the heredoc construct...
EOT;

$text2 = "This quoted text contains the constant A_CONSTANT (" .
         A_CONSTANT .
         ") outside the string quotes...";
echo "$text1<br />$text2";

Output:
This heredoc text contains the constant A_CONSTANT (1) outside the heredoc
construct...
This quoted text contains the constant A_CONSTANT (1) outside the string
quotes...


--
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



--- End Message ---
--- Begin Message ---
At 19:28 01.03.2003, Daniel R. Hansen said:
--------------------[snip]--------------------
>Actually I did try it and couldn't think of a way to work around the matter.
>Thanks for the suggestion.
>
>-----Original Message-----
>From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]
>You simply could have tried it - it's trivial.
>
> [blah]
--------------------[snip]-------------------- 

My apologies - by rereading my message it sounds straightforward arrogant
which it wasn't meant to be. I was referring to your statement "didn't find
anything in the online docs" that led me to the perception you didn't even
try it - sorry for that (but there are so many posters asking questions
that wouldn't even arise if they only had _tried_ it).

Hope my suggestion helps though :-)


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



--- End Message ---
--- Begin Message ---
On Sat, 1 Mar 2003 17:26:37 +0300, you wrote:

>Dear Sirs,
>
>I wa using
>
>my @InBody = <STDIN>;
>
>To get data from email after piping. I am not sure that what I should use to
>have same result with php?

Hi,

Read the section beginning with "Table 23-2. CLI specific Constants"
here:

http://www.php.net/manual/en/features.commandline.php

You should find what you need...

--- End Message ---
--- Begin Message ---
> I'm trying to implement the following functionality into the file 
> test.php:
> 
> When I scroll down the page and then hit a button, the page 
> should remember
> the scrolled position, refresh the page and then scroll down to the
> remembered position. I've almost managed to make this work, but 
> only almost.
> 
> The first time I click one of the buttons, the page won't scroll, 
> but after
> that it works fine. I think the reason for this is that the function
> hentKoordinat() gets called before $teller is set. hentKoordinat() uses
> $teller.
> 
> Anyone know a way to make this work?
> 
> Thanks alot!
> 
> Lars

I've probably misunderstood but can you not use an HTML anchor...?
Rich


--- End Message ---
--- Begin Message ---
What I would recommend is PHPmyAdmin. I believe it's open source and written
in PHP specifically as a utility for mySQL.

I'm sure you can find it at sourceforge.net (or a similar site) .

"Jeremy N.E. Proffitt" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I need to create some simple web forms for entering, changing, deleteing
information from a fairly simple MySQL database.  This is to be for internal
use, so doesn't have to be really fancy or have alot of error checking.
  I could make a form for each table myself, but I would think their is an
easier way...

Cheers
Jeremy



--- End Message ---
--- Begin Message ---
> 
> If I exec a command like ifconfig, I'd like to be able to parse.  What is
> the best way to go about thihs?  An example output from ifconfig is:

Check http://www.php.net/manual/en/function.passthru.php

Rich

--- End Message ---
--- Begin Message ---
> I run the following script:
> 
> <?
> phpinfo();
> ?>
> 
> // the page loads o.k. when the semi-colon remains as in:
> ;extension=php_gd2.dll
> 
> but if I remove the semicolon as in:
> 
> extension=php_gd2.dll
> 
> the page won't load and the server hangs up.
> ..........................................
> 
> \\ this is my php.ini file on MS Win 98/ PHP/ Apache
> 
> 
> ; Directory in which the loadable extensions (modules) reside.
> extension_dir = "C:\PHP\"
> 
> ; Whether or not to enable the dl() function.  The dl() function does NOT
> work
> ; properly in multithreaded servers, such as IIS or Zeus, and is
> automatically
> ; disabled on them.
> enable_dl = On
> 
> extension=php_gd2.dll
> ...................................................
> 
> Any advice on how I can install GD libraries greatly appreciated.
> Thank you.
> Tony Ritter

Hi Tony

Still battling GD I see :)

Are there any errors in the Apache error.log?

What happens if you change your php.ini directive to ...

extension_dir = C:/php/extensions

HTH
Rich


--- End Message ---
--- Begin Message ---
Rich,
I've checked my php.ini files on my drive and all I've got is one.

The php_gd2.dll file is in:

C:/PHP/extensions

There was no default folder called extensions when I installed PHP so I made
a directory called extensions under PHP.

Everytime I take out the semicolon in the .ini file, the page won't load and
I've got to shut down Apache server manually.

If I put the semicolon back in, the page loads fine.

I don't have a clue.  Somewhere between the .ini file and Apache something
is very screwed up.

TR


---
[This E-mail scanned for viruses by gonefishingguideservice.com]


--- End Message ---
--- Begin Message ---
P.S.
If you get a moment, maybe you could send me a .txt file of your php.ini
file along with you php_gd2.dll setup.

That way I could check line for line.

Many thanks,
TR

---
[This E-mail scanned for viruses by gonefishingguideservice.com]


--- End Message ---
--- Begin Message ---
> Rich,
> I've checked my php.ini files on my drive and all I've got is one.
>
> The php_gd2.dll file is in:
>
> C:/PHP/extensions
>
> There was no default folder called extensions when I installed
> PHP so I made
> a directory called extensions under PHP.
>
> Everytime I take out the semicolon in the .ini file, the page
> won't load and
> I've got to shut down Apache server manually.
>
> If I put the semicolon back in, the page loads fine.
>
> I don't have a clue.  Somewhere between the .ini file and Apache something
> is very screwed up.
>
> TR
>
You said in your earlier post that in your php.ini your extension_dir is set
to "C:\PHP\" - this is wrong it should be c:/php/extensions
If the extensions directory was not there and you had to create it manually
then where did you get the php_gd2.dll from?
The extensions sub-directory should be there for a normal installation - did
you install from zip?

Rich


--- End Message ---
--- Begin Message ---
> hi there i am setting up a test replication slave server as a mysql db
> master backup if it fails , i would like to know how to
> dynamically connect
> to the slave if the master fails , something really strange i have set the
> host like localhost:3307 for the slave but is still connecting to
> the master
> , and if i shut down the master it wont goto the slave :|
>
>

Not sure I understand ... are you saying that
mysql_connect('localhost:3307','user','password') connects to the master
server? Can you describe the problem in more detail?

Rich


--- End Message ---
--- Begin Message ---
> Hi All,
>
> I'm trying to get a random record each time this script runs;
> Only it's giving me everytime the first record back.. No random at all..
>
> // generate and execute query
> $query = "SELECT stedenid, naamstad, stadomschrijvk FROM steden
> ORDER BY RAND() LIMIT 1";
> $result = mysql_query($query) or die ("Error in query: $query. "
> . mysql_error());
> $row = mysql_fetch_object($result);
> echo $row->naamstad;
>
>
> Version info;
>
> PHP 4.3.1
> Mysql 3.23.54
>
> When i'm trying to excute the SELECT statement in phpmyadmin; i'm
> only getting the first record back and when i'm taking off the
> LIMIT 1 it will display all the records in ascending order so
> also not in random..
>
>
> Regards,
>
> Frank


Frank

This really belongs on the MySQL list but there was a known issue with
RAND() on 3.23.54 - can you upgrade? If your table has an auto_increment ID
column then a workaround would be to use rand() in PHP to generate a random
ID then use that with a 'where id = '.$id in your query...

HTH
Rich


--- End Message ---
--- Begin Message ---
Thanks guys for the info; I will speak to my ISP!

Have a nice weekend!

Regards,

Frank
----- Original Message -----
From: "Rich Gray" <[EMAIL PROTECTED]>
To: "Frank Keessen" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Sunday, March 02, 2003 2:36 AM
Subject: [PHP-DB] RE: [PHP] Random not working?


> > Hi All,
> >
> > I'm trying to get a random record each time this script runs;
> > Only it's giving me everytime the first record back.. No random at all..
> >
> > // generate and execute query
> > $query = "SELECT stedenid, naamstad, stadomschrijvk FROM steden
> > ORDER BY RAND() LIMIT 1";
> > $result = mysql_query($query) or die ("Error in query: $query. "
> > . mysql_error());
> > $row = mysql_fetch_object($result);
> > echo $row->naamstad;
> >
> >
> > Version info;
> >
> > PHP 4.3.1
> > Mysql 3.23.54
> >
> > When i'm trying to excute the SELECT statement in phpmyadmin; i'm
> > only getting the first record back and when i'm taking off the
> > LIMIT 1 it will display all the records in ascending order so
> > also not in random..
> >
> >
> > Regards,
> >
> > Frank
>
>
> Frank
>
> This really belongs on the MySQL list but there was a known issue with
> RAND() on 3.23.54 - can you upgrade? If your table has an auto_increment
ID
> column then a workaround would be to use rand() in PHP to generate a
random
> ID then use that with a 'where id = '.$id in your query...
>
> HTH
> Rich
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message ---
You might try getting the random number before the query.

-----Original Message-----
From: Rich Gray [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 01, 2003 8:37 PM
To: Frank Keessen; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] RE: [PHP] Random not working?


> Hi All,
>
> I'm trying to get a random record each time this script runs;
> Only it's giving me everytime the first record back.. No random at all..
>
> // generate and execute query
> $query = "SELECT stedenid, naamstad, stadomschrijvk FROM steden
> ORDER BY RAND() LIMIT 1";
> $result = mysql_query($query) or die ("Error in query: $query. "
> . mysql_error());
> $row = mysql_fetch_object($result);
> echo $row->naamstad;
>
>
> Version info;
>
> PHP 4.3.1
> Mysql 3.23.54
>
> When i'm trying to excute the SELECT statement in phpmyadmin; i'm
> only getting the first record back and when i'm taking off the
> LIMIT 1 it will display all the records in ascending order so
> also not in random..
>
>
> Regards,
>
> Frank


Frank

This really belongs on the MySQL list but there was a known issue with
RAND() on 3.23.54 - can you upgrade? If your table has an auto_increment ID
column then a workaround would be to use rand() in PHP to generate a random
ID then use that with a 'where id = '.$id in your query...

HTH
Rich


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


--- End Message ---
--- Begin Message ---
Mark wrote:

> 
> --- Daniel Harik <[EMAIL PROTECTED]> wrote:
>> > > Hello,
>> > >
>> > > I have 2 tables users table, that stores user info, and photos
>> table,
>> > > i want to select all users with one photo form photos table,
>> but i don't
>> > > want it to be photos * users = result.
>> > >
>> > > Is there way to do it?
>> > 
>> > Assuming you mean, you have a table called user_info and another
>> called
>> > photos and each of them has a common element AND there must be a
>> photo for
>> > the user then you could use this sort of select...
>> > 
>> > select user_info.name, photo.image from user_info, photo where
>> user_info.id
>> > = photo.user_id
>> > 
>> > The above will not display anything if there are no matching id
>> to user_id
>> > so if one of your users didn't have a photo they would not get
>> displayed.
>> > Also, if a user had more than one photo they would all be
>> displayed.
>> > 
>> > If your users are expected to have one and only one photo then
>> you may
>> want
>> > get rid of the photo table and just put the photo in the user
>> table.
>> > 
>> > HTH
>> 
>> 
>> Thank You for your reply, but the problem is that users may have
>> many
>> photos, and i need to get only one, i use folllowing sql:
>> SELECT users.username, photos.file FROM users left join photos on
>> users.id=photos.userid
>> 
>> 
>> And i get:
>> 
>>  username     file
>> dan  9a2de085e456e78ed66f079572638ff3.jpg
>> dan  852d28e6fa730f6d29d69aacd1059ae7.jpg
>> dan  672df2f16e89e3dc92ff74e3a0fa4b4f.jpg
>> dan  8bae6f20ed6e12ba1c86d04b8ebc9e1f.jpg
>> dan  7de9d2db2b2096cfc3f072f8c15a9e50.jpg
>> 404  f474a8ee5965f0a792e5b626fb30c2cd.jpg
>> 404  3acd391cf7abafa032c5e3b21eb7b322.jpg
>> 404  4e5df8cfa4bce5dd30c1166b8a86fa23.jpg
>> Bedman  NULL
>> 
>> but i want only 3 users from this join, not 3x3=9
> 
> If you only want the users, and not the photos, then the previous
> post should do what you want. But if you also want the photo, and
> there's more than one photoo for a user, how will the code know which
> photo you want? Do you want a random photo from each user? The last
> photo from each user? The first?
> 
> Mark

Random is fine

--- End Message ---
--- Begin Message ---
Paul Burney wrote:

> on 2/28/03 3:15 PM, Daniel Harik at [EMAIL PROTECTED] appended the
> following bits to my mbox:
> 
>> Thank You for your reply, but the problem is that users may have many
>> photos, and i need to get only one, i use folllowing sql:
>> SELECT users.username, photos.file FROM users left join photos on
>> users.id=photos.userid
>> 
>> And i get:
>> 
>> username     file
>> dan  9a2de085e456e78ed66f079572638ff3.jpg
>> dan  852d28e6fa730f6d29d69aacd1059ae7.jpg
>> dan  672df2f16e89e3dc92ff74e3a0fa4b4f.jpg
>> dan  8bae6f20ed6e12ba1c86d04b8ebc9e1f.jpg
>> dan  7de9d2db2b2096cfc3f072f8c15a9e50.jpg
>> 404  f474a8ee5965f0a792e5b626fb30c2cd.jpg
>> 404  3acd391cf7abafa032c5e3b21eb7b322.jpg
>> 404  4e5df8cfa4bce5dd30c1166b8a86fa23.jpg
>> Bedman  NULL
>> 
>> but i want only 3 users from this join, not 3x3=9
> 
> So you just want the users who have pictures, but not all the pictures for
> each?  Something like:
> 
> SELECT count(*) AS num_photos, username FROM photos LEFT JOIN users ON
> photos.userid=users.id GROUP BY userid
> 
> You could add the file field in there as well, but it would only be
> returning one of the files (the first or last one for that user, but I
> don't know of a way for you to be specific).
> 
> Hope that helps.
> 
> Sincerely,
> 


Thank You, group by users.id did the trick, but now i have another
problem, i want to select users with no photo as well, all with same
sql statment, so far i have 

SELECT users.id, users.gender, users.year, users.month, users.day, 
users.username, users.city, users.country, users.feet, users.inches, 
users.cm, users.openingLine, profiles.bodyType, profiles.ethnic, 
profiles.smoke, profiles.drink, profiles.children, profiles.religion, 
profiles.moment, photos.file FROM users,profiles, photos WHERE 
users.id=profiles.userid GROUP BY users.id

It works fine selecting random photo for user, but doesn't select users
with no photos.

--- End Message ---
--- Begin Message --- Hi,

Thanx for yor reply. Well It worked for me with the same query when I used "HAVING" instead of "where". This is what I got from Mysql Database. However the solution that you have showed is reall good as well.

Thanx
-Dhaval






From: "Uttam" <[EMAIL PROTECTED]>
To: "'Dhaval Desai'" <[EMAIL PROTECTED]>,<[EMAIL PROTECTED]>
Subject: RE: Mysql Date got prob!
Date: Sat, 1 Mar 2003 13:45:53 +0530

try:

select
        date_format(date_add(arrivaldate1, INTERVAL nights1 DAY), '%Y-%m-%d') as
dept_date1
from mytable
where
        (date_add(arrivaldate1, INTERVAL nights1 DAY) BETWEEN '2003-02-01' AND
'2003-02-10')

regds,
-----Original Message-----
From: Dhaval Desai [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 15:48
To: [EMAIL PROTECTED]
Subject: Mysql Date got prob!


Hello,

As related to my earlier question


select date_format(date_add(arrivaldate1, INTERVAL nights1 DAY), '%Y- %m-%d') as dept_date1 from mytable where ('dept_date1' BETWEEN '2003-02-01' AND '2003-02-10')

The above query is valid but returns 0 because 'dept_date1' is treated
as a
string. I want dept_date1 to be treated as  date so that it can be
compared.


I hope it is possible...


Thank you!

-Dhaval


_________________________________________________________________ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail


_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail


--- End Message ---
--- Begin Message ---
Is there a way that i can restrict access to an entire directory using
PHP/MYSQL so only valid users in the Database can have access to a resource?

------
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]

+64 (9) 576 9491
+64 021-048-3999

------
Friends are like stars
You can't allways see them,
but they are always there.

------
Websites:

PhilipNZ.com - Design.
http://www.philipnz.com/
[EMAIL PROTECTED]

Philip's Domain // Internet Project.
http://www.philipsdomain.com/
[EMAIL PROTECTED]

Vital Kiwi / NEWMAN.NET.NZ.
http://www.newman.net.nz/
[EMAIL PROTECTED]



--- End Message ---
--- Begin Message ---
At 21:12 01.03.2003, Philip J. Newman said:
--------------------[snip]--------------------
>Is there a way that i can restrict access to an entire directory using
>PHP/MYSQL so only valid users in the Database can have access to a resource?
--------------------[snip]-------------------- 

1) Put that folder outside the document root of your webserver so they
cannot be retrieved by accessing their URL directly
2) After authenticating, server the files using readfile() or similar.

You could even use the ErrorDocument directive in Apache to run this.
Consider this deirectory layout:

   ~newmanpj/
      + -- htdocs                <== the web root (home of hidden_files.php)
      |      + -- hidden_files   <== an empty directory, only .htaccess
available
      |
      + -- hidden_files          <== the directory holding your files

The .htaccess file within the hidden directory contains
    ErrorDocument 404 /hidden_files.php

Now when a user requests
http://www.newmanpj.com/hidden_files/somestuff.html, the hidden_files.php
will be triggered by apache, having $_SERVER['REDIRECT_URL'] set to the
requested URL.

hidden_files.php does the following:
1) Check if the request is for a hidden file:
   No => serve a general 404 Error message
   Yes => continue
2) Check authentication:
   Not authenticated => goto login (or return 401 Authenticate)
   Yes - readfile(requested_file)

Hope this helps,


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



--- End Message ---
--- Begin Message ---
Check out :

Authenticating against .htpasswd style files.
http://www.weberdev.com/index.php3?GoTo=get_example.php3?count=109

Sincerely

berber

Visit http://www.weberdev.com/ Today!!!
To see where PHP might take you tomorrow.


-----Original Message-----
From: Rob Packer [mailto:[EMAIL PROTECTED] 
Sent: Saturday, February 15, 2003 6:06 PM
To: [EMAIL PROTECTED]
Subject: [PHP] .htpasswd and PayPal generated passwords


    I use PayPal to generate a username and password and then write them
to the .htpasswd file. If I were to switch to using a database (because
.htaccess seems to always prompt twice!) how would I perform the
comparison for the passwords? It would seem that everytime you generate
an encrypted password it's different. So how would you compare them?
Also, does anyone know what the encryption method used by PayPal is?

Thanks for any help...

Robert Packer



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


--- End Message ---
--- Begin Message --- I'm building a site that allows ppl to upload images. PHP was compiled with the GD lib so I'm able to verify all sorts of info about the image for validation. However, I was wondering if there is a way to convert a non-jpeg image to jpeg just by using the GD functions as opposed to using unix command line utilities and system/exec functions (the hosting company doesn't like that, and personally, i don't like the 'cross ur fingers' aspect of php/commandline stuff).
Some browsers don't like some image types and we're trying to make jpg the standard extension, though we allow ppl to upload BMP, TIF, GIF, PNG, and JPG files.
I can get the image and put it where I want on the server, but is there a way to finesse the GD lib to create a jpeg from whatever image type they upload? If someone just has an idea that may or may not work, I'm open to suggestions, pseudo-code is welcome. Seems that somewhere in the GD lib's capabilities there's a way to squeeze out what i want, but I can't grasp it.
Thank you,
screamingpanda





_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail


--- End Message ---
--- Begin Message ---
> Don't reinvent the wheel :)
> 
> http://www.phpadsnew.com/one/


Then how would people learn? Eventually everyone that
knows how to make the wheel will die and the knowledge
to make it will be forgotten.

J.



__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

--- End Message ---
--- Begin Message ---
> The other problem is that if I open two browser
> windows to your site, one after the other, and see 
> two banners, and then click on the first one, am
> I going to go to the site for the second one?


Yes, that is one of the main problems. Would using
sessions help end this?

J.



__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

--- End Message ---
--- Begin Message ---
> Would this do it for you?


No, that is that the problem. Showing the banner is.
It's when they click on it.

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

--- End Message ---
--- Begin Message --- Hello,

I didn't find in the doc how to:
- Know the full path of the current directory. Like /var/www/to/the/path
- Know under which user work apache, to know when I create a file whose file it is...

Thanks.


--- End Message ---
--- Begin Message ---
"Vincent M." <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>
> I didn't find in the doc how to:
>   - Know the full path of the current directory. Like /var/www/to/the/path

try using dirname(__FILE__) or dirname($_SERVER['PATH_TRANSLATED'])

> - Know under which user work apache, to know when I create a file whose
> file it is...

in unix, a safe installation will run apache as nobody.

Greg
--
phpDocumentor
http://www.phpdoc.org



--- End Message ---
--- Begin Message ---
Hello,
I have a file that the content always change every second or so. I want to 
display this to the web. Is this possible to do using PHP? If yes how?
I can have the content displayed to the web only update every 5 seconds or so, 
for example. Will this put the server into heavy load?

If PHP is not the best way to do this, does anyone knows if Java applet can do 
this?

Thanks

RDB

--- End Message ---
--- Begin Message ---
Hello, 

I was wondering how I could download a file via FTP in parts. (For eg
0bytes - 4000000 byes and then from 4000001 bytes to 8000001 bytes)

Thank you,

- Siddharth Hegde



--- End Message ---
--- Begin Message ---
Question:

is it better to store user names as upper and lower case? should they bee
converted to one case?

I have a script the checks for names and  ...

Mark is not the same as mark, or MaRk ...

is there a way of making a string into lower case?


------
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]

+64 (9) 576 9491
+64 021-048-3999

------
Friends are like stars
You can't allways see them,
but they are always there.

------
Websites:

PhilipNZ.com - Design.
http://www.philipnz.com/
[EMAIL PROTECTED]

Philip's Domain // Internet Project.
http://www.philipsdomain.com/
[EMAIL PROTECTED]

Vital Kiwi / NEWMAN.NET.NZ.
http://www.newman.net.nz/
[EMAIL PROTECTED]



--- End Message ---
--- Begin Message ---
LOL got a reply to this before i ever got the message my self ... 

----- Original Message ----- 
From: "Philip J. Newman" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 02, 2003 10:56 AM
Subject: [PHP] Upper and lower case.


> Question:
> 
> is it better to store user names as upper and lower case? should they bee
> converted to one case?
> 
> I have a script the checks for names and  ...
> 
> Mark is not the same as mark, or MaRk ...
> 
> is there a way of making a string into lower case?
> 
> 
> ------
> Philip J. Newman.
> Head Developer
> [EMAIL PROTECTED]
> 
> +64 (9) 576 9491
> +64 021-048-3999
> 
> ------
> Friends are like stars
> You can't allways see them,
> but they are always there.
> 
> ------
> Websites:
> 
> PhilipNZ.com - Design.
> http://www.philipnz.com/
> [EMAIL PROTECTED]
> 
> Philip's Domain // Internet Project.
> http://www.philipsdomain.com/
> [EMAIL PROTECTED]
> 
> Vital Kiwi / NEWMAN.NET.NZ.
> http://www.newman.net.nz/
> [EMAIL PROTECTED]
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
> is it better to store user names as upper and lower case? should they
bee
> converted to one case?

Store it where? It depends if the place you store it in and the
comparisons there are going to be case sensitive or not. Most database
fields are going to be case sensitive while a PHP comparison will not
be. 
 
> I have a script the checks for names and  ...
> 
> Mark is not the same as mark, or MaRk ...

In PHP when you test with an "equal to" (==) they are not the same. You
can use the strcasecmp() function to compare string case insensitively,
though. In a general database VARCHAR field, they would be the same.

> is there a way of making a string into lower case?

Strtolower()

---John Holmes...



--- End Message ---
--- Begin Message ---
Is there an easy way to create a calendar in PHP, such as a calendar
function?  All I need is a dynamically created calendar to link to other
pages.

Jason D. Williard




--- End Message ---
--- Begin Message ---
Check http://www.cascade.org.uk/software/php/calendar/

I've used that one on several sites.

-----Original Message-----
From: Jason D. Williard [mailto:[EMAIL PROTECTED] 
Sent: Saturday, March 01, 2003 4:28 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Calendar


Is there an easy way to create a calendar in PHP, such as a calendar
function?  All I need is a dynamically created calendar to link to other
pages.

Jason D. Williard




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


--- End Message ---
--- Begin Message ---
Greetings All...

Usually I am helping others on the list but this time I am asking for
help!!

I was wondering if someone could offer some clarity for me as
my years of using Apache has never seen the following as a possibility.

Background: This server is using PHP along with Apache

If a server (entire box) was I/O bound and wasn't coping with the load
then
would Apache simple close the connection (I think this) or serve a 404
error.

The reason for asking this is not that I have gone Mad but that a
consulting firm is trying to tell us that our server is I/O bound
and serving 404 errors.  I just can't see how.

Thanks to all.


Timothy Hitchens (HiTCHO)
Web Application Consulting
e-mail: [EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---
If your server is IO bound and not CPU bound in most cases it will
continue to serve requests as long as the maximum number of concurrent
connections is not exceeded or they don't timeout.  

In any case your server should not give a 404 error because of being I/O
bound, 404 means document not found, they may be mistaking it with a
server too busy error message.

Jason
On Sat, 2003-03-01 at 15:50, Timothy Hitchens (HiTCHO) wrote:
> Greetings All...
> 
> Usually I am helping others on the list but this time I am asking for
> help!!
> 
> I was wondering if someone could offer some clarity for me as
> my years of using Apache has never seen the following as a possibility.
> 
> Background: This server is using PHP along with Apache
> 
> If a server (entire box) was I/O bound and wasn't coping with the load
> then
> would Apache simple close the connection (I think this) or serve a 404
> error.
> 
> The reason for asking this is not that I have gone Mad but that a
> consulting firm is trying to tell us that our server is I/O bound
> and serving 404 errors.  I just can't see how.
> 
> Thanks to all.
> 
> 
> Timothy Hitchens (HiTCHO)
> Web Application Consulting
> e-mail: [EMAIL PROTECTED]
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message --- Hello all,

I've got several questions and i'm hoping i can find answers or links to places which contain the answers.

1. How can i set a script to run at a certain time?

For example, say i want to send a mass e-mail at 5:00pm every night which contains the latest updates to the website. I know how to generate the mail and then send it to everyone's e-mail in a MySQL table. But how do i set it to run automaticaly?

Answers for both Linux and Windows systems would be nice...

2. How do i open a HTML file, extract all the text and then break up the text into variables..

For example, i've got a HTML files which all have the same structure


Title: Magocracy
Author: TheHeadSage
E-Mail: [EMAIL PROTECTED]
Category: Comedy, Action
Keywords: Ilja, Magic, Ilkeria
Rating: PG-13
Spoilers: None, origional story.
Summary: [Sumary here]

Chapter Body
<<


How would i get all the text and break it up into the variables $title, $author, $email
ect. So they can be insterted into the MySQL table under the approprate colums.

3. How do i open a Word Document and extract all the text?

As users would like to submit .doc files and i'd like the script to process them..

Thats all the questions so far, any tips, comments, ideas, questions even insults and flames are welcome!

Also please reply to the address: [EMAIL PROTECTED] as i dont trust hotmail.

Thanks in advance,

- Daniel "TheHeadSage" Spain
Founder of Voidsoft.
Server Administrator of The Void
Head of IRC Relations for Manga-Sketchbook.org

_________________________________________________________________
Hotmail now available on Australian mobile phones. Go to http://ninemsn.com.au/mobilecentral/hotmail_mobile.asp


--- End Message ---
--- Begin Message ---
At 00:49 02.03.2003, The Head Sage said:
--------------------[snip]--------------------
>1. How can i set a script to run at a certain time?

*nix: use cron (man crontab)
Windows: use the "at" command (help at)

>2. How do i open a HTML file, extract all the text and then break up the 
>text into variables..
>
>For example, i've got a HTML files which all have the same structure
>
>>>
>Title: Magocracy
>Author: TheHeadSage
>E-Mail: [EMAIL PROTECTED]
>Category: Comedy, Action
>Keywords: Ilja, Magic, Ilkeria
>Rating: PG-13
>Spoilers: None, origional story.
>Summary: [Sumary here]
>
>Chapter Body
><<
>
>
>How would i get all the text and break it up into the variables $title, 
>$author, $email
>ect. So they can be insterted into the MySQL table under the approprate 
>colums.

Using the layout you are showing:
1) Read the file
2) Split headers from body (delimited by an empty line)
3) make an array from the headers, splitting each line by ': '

// Disclaimer: untested
// step 1
$hf = fopen($file, 'r') or die("Can't read $file");
$buffer=fread($hf, filesize($hf));
fclose($hf);

// step 2 - now you have the chapter ready
list($headers, $chapter) = preg_split("/(\n|\r|\r\n|\n\r){2,2}/s", $buffer);

// step 3
$headers = preg_split("/(\n|\r|\r\n|\n\r)/s", $headers);
$arkeywords = array(); // for the "array" method, see below
foreach ($headers as $line) {
    list($var, $value) = preg_split('/:\s*/', $line, 2);
    // you may rather use an associative array instead of variable names
    // the "variable" method:
    $$var = $value;
    // the "array" method
    $arkeywords[$var] = $value;
}

You now have the "body text" in "$chapter", and either an associative
array, or the named variables of the header lines.

>3. How do i open a Word Document and extract all the text?

You might try Word2X (see http://word2x.sourceforge.net/)
Disclaimer - never used it, just been told about it by my friend Google
(question was "Winword conversion Linux").

>Thats all the questions so far, any tips, comments, ideas, questions even 
>insults and flames are welcome!

Nothing else?

Ok, you got something to work on now I believe... *grin*

>- Daniel "TheHeadSage" Spain
>Founder of Voidsoft.
>Server Administrator of The Void

...hopefully not...


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



--- End Message ---
--- Begin Message ---
Untested:

if (preg_match('/^http:\/\/[^\.\s]+\.[^\s]+\/$/i', $string))
   // valid string
else
   // invalid string

Should match a string beginning with 'http://', followed by one or more
characters that are no dots or whitespace, followed by a dot, followed >by one or more characters that are not whitespace, and terminated with >a slash. The terminating 'i' makes the search case insensitive.

I've also been looking for this information. Can you please point me to a list of those string codes? My search for them in the documentation has been fruitless.







_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail


--- End Message ---
--- Begin Message ---
At 01:17 02.03.2003, Kris Jones said:
--------------------[snip]--------------------
>>Untested:
>>
>>if (preg_match('/^http:\/\/[^\.\s]+\.[^\s]+\/$/i', $string))
>>    // valid string
>>else
>>    // invalid string
>>
>
>I've also been looking for this information. Can you please point me to a 
>list of those string codes? My search for them in the documentation has been 
>fruitless.
--------------------[snip]-------------------- 

It is all in the online manual. Start your studies at
    http://www.php.net/manual/en/ref.pcre.php

Chapter LXXXVIII (read 88), titled "Regular Expression Functions (Perl
compatible)", which are my favorites... pay special attention on these
chapters:
    "Pattern Syntax" (http://www.php.net/manual/en/pcre.pattern.syntax.php)
    "Pattern Modifiers"
(http://www.php.net/manual/en/pcre.pattern.modifiers.php)



-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



--- End Message ---
--- Begin Message ---
I know this is probably an easy question, but I am
using stripslashes() on a textarea var, and I don't
think it's working. It doesn't error, but in the
testarea it doesn't seem to work. Ex:

$var = "Thank's";
$var = stripslashes($var);
echo $var;
Output = Thank\'s

Any ideas? Thanx.

-Dade

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

--- End Message ---
--- Begin Message ---
At 01:48 02.03.2003, Dade Register said:
--------------------[snip]--------------------
>I know this is probably an easy question, but I am
>using stripslashes() on a textarea var, and I don't
>think it's working. It doesn't error, but in the
>testarea it doesn't seem to work. Ex:
>
>$var = "Thank's";
>$var = stripslashes($var);
>echo $var;
>Output = Thank\'s
--------------------[snip]-------------------- 

This can't work since there are no slashes to strip...

stripslashes() strips certain slashes from a string. Assume you have a
textarea where the user enters "Thank's", so PHP converts this to
"Thank\'s" (assuming magic_quotes is set to on). Using stripslashes() here
will get rid of these slashes.

BTW - the sample you've sent will output "Thank's" - what are you doing
what you didn't show?


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



--- End Message ---
--- Begin Message ---
Well, only diff is it's a POST from a textarea. With
magicquotes on, you're right, it makes "Thank's"
become "Thank\'s". how can I get rid of that? I'm
posting it to a text file.
-Dade
--- Ernest E Vogelsinger <[EMAIL PROTECTED]>
wrote:
> At 01:48 02.03.2003, Dade Register said:
> --------------------[snip]--------------------
> >I know this is probably an easy question, but I am
> >using stripslashes() on a textarea var, and I don't
> >think it's working. It doesn't error, but in the
> >testarea it doesn't seem to work. Ex:
> >
> >$var = "Thank's";
> >$var = stripslashes($var);
> >echo $var;
> >Output = Thank\'s
> --------------------[snip]-------------------- 
> 
> This can't work since there are no slashes to
> strip...
> 
> stripslashes() strips certain slashes from a string.
> Assume you have a
> textarea where the user enters "Thank's", so PHP
> converts this to
> "Thank\'s" (assuming magic_quotes is set to on).
> Using stripslashes() here
> will get rid of these slashes.
> 
> BTW - the sample you've sent will output "Thank's" -
> what are you doing
> what you didn't show?
> 
> 
> -- 
>    >O     Ernest E. Vogelsinger
>    (\)    ICQ #13394035
>     ^     http://www.vogelsinger.at/
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

--- End Message ---
--- Begin Message ---
At 02:05 02.03.2003, Dade Register said:
--------------------[snip]--------------------
>Well, only diff is it's a POST from a textarea. With
>magicquotes on, you're right, it makes "Thank's"
>become "Thank\'s". how can I get rid of that? I'm
>posting it to a text file.
--------------------[snip]-------------------- 

Use stripslashes().

Try this example:

<?php

$var = $_REQUEST['blah'];
echo '<xmp>$REQUEST[\'blah\']: "', $var, "\"\n";
$var = stripslashes($var);
echo 'stripslashe\'d: "', $var, '"</xmp>';
echo '<form method="post">',
         '<textarea name="blah">',
         $var,
         '</textarea><br />',
         '<input type="submit"></form>';

?>

You will notice the textarea transmits "Thank\'s" which is displayed in the
first line, and stripslashes() removes the backslash and displays "Thank's".

Note that you also must use the stripslashe'd data when constructing the
textarea.


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



--- End Message ---
--- Begin Message ---
I know I am doing the exact thing you are.... If you
or someone else doesn't mind, could you look @
http://dragonz-cavern.mine.nu/poems.phps and see what
I'm doing wrong? I am trying to parse it before it
gets stored in my txt file. plz help. I'd really
appreciate it.
-Dade
--- Ernest E Vogelsinger <[EMAIL PROTECTED]>
wrote:
> At 02:05 02.03.2003, Dade Register said:
> --------------------[snip]--------------------
> >Well, only diff is it's a POST from a textarea.
> With
> >magicquotes on, you're right, it makes "Thank's"
> >become "Thank\'s". how can I get rid of that? I'm
> >posting it to a text file.
> --------------------[snip]-------------------- 
> 
> Use stripslashes().
> 
> Try this example:
> 
> <?php
> 
> $var = $_REQUEST['blah'];
> echo '<xmp>$REQUEST[\'blah\']: "', $var, "\"\n";
> $var = stripslashes($var);
> echo 'stripslashe\'d: "', $var, '"</xmp>';
> echo '<form method="post">',
>          '<textarea name="blah">',
>          $var,
>          '</textarea><br />',
>          '<input type="submit"></form>';
> 
> ?>
> 
> You will notice the textarea transmits "Thank\'s"
> which is displayed in the
> first line, and stripslashes() removes the backslash
> and displays "Thank's".
> 
> Note that you also must use the stripslashe'd data
> when constructing the
> textarea.
> 
> 
> -- 
>    >O     Ernest E. Vogelsinger
>    (\)    ICQ #13394035
>     ^     http://www.vogelsinger.at/
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

--- End Message ---
--- Begin Message ---
At 03:37 02.03.2003, Dade Register said:
--------------------[snip]--------------------
>I know I am doing the exact thing you are.... If you
>or someone else doesn't mind, could you look @
>http://dragonz-cavern.mine.nu/poems.phps and see what
>I'm doing wrong? I am trying to parse it before it
>gets stored in my txt file. plz help. I'd really
>appreciate it.
--------------------[snip]-------------------- 

You're doing everything right. If you have a look at the datfile you'll
notice there are NO backslashes. Right?

Ok, so the culprit must be fgets() - and indeed this can be found in the
online manual (http://www.php.net/manual/en/function.fgets.php), in the
user comments:

php at silisoftware dot com 13-Jun-2002 06:44   
Beware of magic_quotes_runtime !
php.ini-recommended for PHP v4.2.1 (Windows) had magic_quotes_runtime set
ON, and that addslash'd all input read via fgets()

So the solution here is to either add stripslashes() after your datfile
read, or to use set_magic_quotes_runtime(0) (see
http://www.php.net/manual/en/function.set-magic-quotes-runtime.php).



-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



--- End Message ---
--- Begin Message ---
Thanx a lot for your help.
It adds to the .dat file. it's not fgets().
Dade [EMAIL PROTECTED]'s
That's from the dat file..... any other ideas?
-Dade
--- Ernest E Vogelsinger <[EMAIL PROTECTED]>
wrote:
> At 03:37 02.03.2003, Dade Register said:
> --------------------[snip]--------------------
> >I know I am doing the exact thing you are.... If
> you
> >or someone else doesn't mind, could you look @
> >http://dragonz-cavern.mine.nu/poems.phps and see
> what
> >I'm doing wrong? I am trying to parse it before it
> >gets stored in my txt file. plz help. I'd really
> >appreciate it.
> --------------------[snip]-------------------- 
> 
> You're doing everything right. If you have a look at
> the datfile you'll
> notice there are NO backslashes. Right?
> 
> Ok, so the culprit must be fgets() - and indeed this
> can be found in the
> online manual
> (http://www.php.net/manual/en/function.fgets.php),
> in the
> user comments:
> 
> php at silisoftware dot com 13-Jun-2002 06:44   
> Beware of magic_quotes_runtime !
> php.ini-recommended for PHP v4.2.1 (Windows) had
> magic_quotes_runtime set
> ON, and that addslash'd all input read via fgets()
> 
> So the solution here is to either add stripslashes()
> after your datfile
> read, or to use set_magic_quotes_runtime(0) (see
>
http://www.php.net/manual/en/function.set-magic-quotes-runtime.php).
> 
> 
> 
> -- 
>    >O     Ernest E. Vogelsinger
>    (\)    ICQ #13394035
>     ^     http://www.vogelsinger.at/
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

--- End Message ---
--- Begin Message ---
At 04:03 02.03.2003, Dade Register said:
--------------------[snip]--------------------
>Thanx a lot for your help.
>It adds to the .dat file. it's not fgets().
>Dade [EMAIL PROTECTED]'s
>That's from the dat file..... any other ideas?
--------------------[snip]-------------------- 

add this line vefore and after stripslashes() and see what you get:

echo '<xmp>', $poem, '</xmp>';

If I type "I've set it up" it should read

I\'ve set it up
I've set it up

or your stripslashes is not working.


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



--- End Message ---
--- Begin Message ---
Dan --

Just a short followup to your note, though I hope to come back to it when
I get a breather.

Yes, anything is possible if you have the gumption :-)  You sound like
you've been around the web a bit and aren't scared, so feel free to dig
in and try it.  PHP is a fairly easy language to grasp, especially if you
speak any perl.

I enjoy the SAMS PHP Developer's Cookbook, though there are others out
there I'd love to have.  I'm one of those coders who would love to work
up a quote for the job if you're still in the market for hiring.

I like the idea; I once put in a bid on a sailboat cabin reservation
system for a fellow who ran a cruising sailboat with about 8 berths, and
this sounds quite similar.  I like little businesses like that who aren't
afraid of some technology :-)


HTH & HAND & at the very least Good Luck!

:-D
-- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgp00000.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
I have a form that allows someone to upload a text file, the contents of
which will be inserted into the database. When I fread() the file, there is
some garbage at the beginning and end of the text.

Here's what the text looks like:

    This is the sentence of text.

Here's what it looks like after uploaded and fread():

    *ch?¡®ºdä?º†Ím This is the sentence of text.SORT~€ÿÿ


The text file being uploaded is a BBedit file, which should be a plain text
file. I'm not sure where this garbage is coming, and if there's an easy way
to remove it before I put this into the Database. I searched the PHP help
files for an hour and searched here, and couldn't find anything related.

I'm using PHP 4.2.3 on a Redhat Linux server.

Thanks.


--- End Message ---
--- Begin Message ---
> I have a form that allows someone to upload a text file, the contents
of
> which will be inserted into the database. When I fread() the file,
there
> is
> some garbage at the beginning and end of the text.
> 
> Here's what the text looks like:
> 
>     This is the sentence of text.
> 
> Here's what it looks like after uploaded and fread():
> 
>     *ch?¡®ºdä?º†Ím This is the sentence of text.SORT~€ÿÿ
> 
> 
> The text file being uploaded is a BBedit file, which should be a plain
> text
> file. I'm not sure where this garbage is coming, and if there's an
easy
> way
> to remove it before I put this into the Database. I searched the PHP
help
> files for an hour and searched here, and couldn't find anything
related.
> 
> I'm using PHP 4.2.3 on a Redhat Linux server.
> 
> Thanks.

Are you using Apache2? IIRC, there was a bug where data would get added
to the POST data, or something along those lines...

What if you just look at the file with a regular text editor? Do you see
that data there after it's uploaded and written to the server, or does
it just appear into the data when it's fread()?

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



--- End Message ---
--- Begin Message ---
> Are you using Apache2? IIRC, there was a bug where data would get added
> to the POST data, or something along those lines...
> 
> What if you just look at the file with a regular text editor? Do you see
> that data there after it's uploaded and written to the server, or does
> it just appear into the data when it's fread()?
> 
> ---John W. Holmes...
 
John, when I open the file in a text editor I don't see the garbage, just
the text. I have Apache 1.3.22 on my server. I'm not writing the contents to
a file once uploaded to the server because I want to store it in a database
field. The garbage is added to the DB just as it appears when I echo the
variable to the screen after the file has been uploaded.

Also, I'm doing the fread() on the tmp_name after the file is uploaded,
because I don't need the file once I read the contents into a variable.

I was wondering if changing the "enctype" parameter in the <form> tag would
make a difference (but I don't know what to change it to). Currently it's
set to "multipart/form-data".

Thanks!


--- End Message ---
--- Begin Message --- Has anyone successfully gotten fusebox for php to work on AIX w/ 4.3.1? The server I am using has globals turned off, but I have this in the index file,

extract($_SERVER);
extract($_GET);
extract($_POST);
extract($_COOKIE);

but all I get is a blank screen. The code is fine because when it is run on a regular linux box, it works fine.

Anyone offer any tips?

Chris


--- End Message ---
--- Begin Message ---
I know this is a php forum. Please don't be upset with
me, but I have a JS problem which nobody I know can
seem to figure out. Here goes:

<script LANGUAGE="JavaScript">
var w1 = "1000";
var h1 = "672";
if (w1 <= screen.width){
if (h1 <= screen.height){
document.write("<a
href="/pics.php?view=popup&image=2003-01-January/image1.jpg"
onclick="NewWindow(this.href,'popup','1000','672','no');return
false;"><img
src="/pics/2003-01-January/image1-thumb.jpg"
border="0" alt="Image 1 of 64"></a>&nbsp;")}
else{
document.write("<a
href="/pics.php?view=popup&image=2003-01-January/image1.jpg"
onclick="NewWindow(this.href,'popup','1000','screen.height','yes');return
false;"><img
src="/pics/2003-01-January/image1-thumb.jpg"
border="0" alt="Image 1 of 64"></a>&nbsp;")}
else{
document.write("<a
href="/pics.php?view=popup&image=2003-01-January/image1.jpg"
onclick="NewWindow(this.href,'popup','screen.width','screen.height','yes');return
false;"><img
src="/pics/2003-01-January/image1-thumb.jpg"
border="0" alt="Image 1 of 64"></a>&nbsp;")}
</script>

I am trying to make a popup window for a big image to
match it's size using php's getimagesize() function,
setting that in the browser as var w1 and h1. Then
trying to get JS to popup a window with or without
scroll bars depending on your screen size... I know
this is complicated. But it's fun. if anyone knows
anyplace that I am messing up, or wants to see the php
of this w/ the JS, let me know. Thanx to all for your
great advise.
-Dade

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

--- End Message ---
--- Begin Message ---
> document.write("<a
> href="/pics.php?view=popup&image=2003-01-January/image1.jpg"
> onclick="NewWindow(this.href,'popup','1000','672','no');return
> false;"><img
> src="/pics/2003-01-January/image1-thumb.jpg"
> border="0" alt="Image 1 of 64"></a>&nbsp;")}

Shouldn't you be escaping some quotes here? The "string" your sending to
document.write() is delineated by double quotes, but there are double
quotes within the string itself. I'm sure that'll cause a JavaScript
error. Escape double quotes within the string with the \ character. 

document.write("<a
href=\"/pics.php?view=popup&image=2003-01-January/image1.jpg\"
onclick=\"NewWindow(this.href,'popup','1000','672','no');return
false;\"><img
src=\"/pics/2003-01-January/image1-thumb.jpg\"
border=\"0\" alt=\"Image 1 of 64\"></a>&nbsp;")}

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



--- End Message ---
--- Begin Message ---
I am wondering if anyone out there has some really good references in
regards to scripts distributed as open source using the GPL. In the last
three years that I have worked on open source projects I have seen several
people "steal" a program, change the name and then try to distribute it as
something else.

So I am wondering what people here prefer to use for a license, is there
anyway to combat these kinds of people, etc.

Why do I ask now? Because it has happened again, only this time, the person
is actively marketing this "new" script.

Jeff



--- End Message ---
--- Begin Message --- They're doing nothing wrong as long as they distribute the source under the GPL.

Jeff Lewis wrote:

I am wondering if anyone out there has some really good references in
regards to scripts distributed as open source using the GPL. In the last
three years that I have worked on open source projects I have seen several
people "steal" a program, change the name and then try to distribute it as
something else.

So I am wondering what people here prefer to use for a license, is there
anyway to combat these kinds of people, etc.

Why do I ask now? Because it has happened again, only this time, the person
is actively marketing this "new" script.

Jeff






-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




--- End Message ---

Reply via email to