php-general Digest 14 Oct 2002 00:03:11 -0000 Issue 1642

Topics (messages 119783 through 119819):

Re: Upload Problem
        119783 by: Sascha Cunz

Re: Predefined variables not set?
        119784 by: Sascha Cunz
        119801 by: Oscar F
        119802 by: Mark Charette

Re: A little help needed, I cant figure!
        119785 by: John W. Holmes
        119797 by: Chris Hewitt
        119809 by: David Freeman
        119812 by: Randum Ian
        119814 by: David Freeman

Re: newline in string
        119786 by: John W. Holmes
        119793 by: Shawn McKenzie

Re: php cgi question
        119787 by: David Cook
        119788 by: Marco Tabini
        119790 by: David Cook
        119794 by: Marco Tabini

Re: PHP/mySQL help or advice
        119789 by: Marco Tabini

about mssql.....
        119791 by: php
        119792 by: John W. Holmes

People who searched this also searched this!
        119795 by: Randum Ian

How to access MS ACCESS's database files
        119796 by: php

Re: php 4.3.0pre and openssl 0.96g compile error
        119798 by: Tony Earnshaw

Fatal error: Maximum execution time of 30 seconds exceeded
        119799 by: scott
        119800 by: John W. Holmes
        119803 by: Thoenen, Peter  Mr.  EPS
        119804 by: Chris Hewitt
        119806 by: Sascha Cunz

Image resize
        119805 by: Christian Ista

compiling mailparse into PHP
        119807 by: Jeff Schwartz

Odd Problem
        119808 by: Stephen
        119810 by: John W. Holmes

Simple HTML-Form Question
        119811 by: Lars H. Korte
        119813 by: Sascha Cunz
        119815 by: Chip Wiegand
        119816 by: Sascha Cunz

$HTTP_GET_VARS within a function ??
        119817 by: John Negretti
        119818 by: Marco Tabini

global variable preference for self
        119819 by: Thoenen, Peter  Mr.  EPS

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 ---
Hi,
as far as i can follow you, you want to:
  1. copy a file from position a to position b.
  2. read it from position b.
  3. and delete it at position b.

Why not read it directly from position a?
So what about:
  $content = implode("<br>", file($userfile));

Anyway: You should initialize $i in any way, best with zero -> $i=0; before 
the while loop.
You check if 0.tab 1.tab 2.tab; if 2.tab exists, you create 3tab (A dot seems 
to be missing) $destfile .= '.tab'; instead of $destfile .= "tab";

Is this script executed on unix? That would clearify why it could not find 
C:\\My Documents\\lyrics\\C_DTBS\\SLIME.TXT :-)

--Sascha

Am Sonntag, 13. Oktober 2002 12:15 schrieb [EMAIL PROTECTED]:
> I posted "User Upload" and with no advice I attempted to use the sources i
> could find and came up with the following:
>
> while (file_exists("$i.tab")) {
> $i ++;
> }
> $destfile = $i;
> $destfile .= "tab";
> stripslashes($userfile);
> copy($userfile, "/uploads/" . $destfile);
> chdir("/uploads");
> $lines = file($destfile);
> $content = implode("<br>", $lines);
> unlink($destfile);
> echo("$userfile_name");
>
> It doesnt work (surprise, surprise), what im trying to do is upload the
> file to my /uploads/ directory then read it and store it on the $content
> variable, then the content variable inserts a row into db (allready done),
> then I delete the file the while loop is to make sure I dont overwrite the
> file and make an error in my database.
>
> The errors PHP returns are:
>
> Warning: Unable to open 'C:\\My Documents\\lyrics\\C_DTBS\\SLIME.TXT' for
> reading: No such file or directory in /home/tabzilla/public_html/doadd.php
> on line 89
>
> Warning: ChDir: No such file or directory (errno 2) in
> /home/tabzilla/public_html/doadd.php on line 90
>
> Warning: file("tab") - No such file or directory in
> /home/tabzilla/public_html/doadd.php on line 91
>
> Warning: Bad arguments to implode() in /home/tabzilla/public_html/doadd.php
> on line 92
>
> Warning: unlink() failed (No such file or directory) in
> /home/tabzilla/public_html/doadd.php on line 93
>
>
> ANY HELP? ANYONE???

--- End Message ---
--- Begin Message ---
Am Sonntag, 13. Oktober 2002 10:04 schrieb Miles:
> When trying to get $_SERVER["QUERY_STRING"] I am getting 'Undefined index
> QUERY_STRING' error
>
> If there is a query string, e.g.  www.site.com/index.php?hello_world then
> it IS defined.  So it seems that PHP is complaining about undefined
> variables, rather than just outputting nothing.
>
> How can I fix this?  I've had no problems until i reinstalled php today...

I think on your prior installation, error reporting level was set lower than 
on your new installation. The better way is to fix the script, that this 
condition doesn't occur at all --> 
if (isset($_SERVER['QUERY_STRING'])) { ... }

Sascha
--- End Message ---
--- Begin Message ---
I'm pretty sure it's not $_SERVER["QUERY_STRING"], it's 
$_SERVER['QUERY_STRING'] (note the ' instead of ").

HTH.

  Oscar F.-


Miles wrote:

> When trying to get $_SERVER["QUERY_STRING"] I am getting 'Undefined index 
>QUERY_STRING' error
> 
> If there is a query string, e.g.  www.site.com/index.php?hello_world then it IS 
>defined.  So it seems that PHP is complaining about undefined variables, rather than 
>just outputting nothing.
> 
> How can I fix this?  I've had no problems until i reinstalled php today...
> 
> Cheers,
> 
> Miles
> 
> 


--- End Message ---
--- Begin Message ---
In this context it makes no difference whether or not " or ' is used ("
allows variable substitution within the quoted string, ' does not) since
there's no substitution taking place.

Insert a phpinfo() in the top of your code to see all the variables that
_are_ being set.

-----Original Message-----
From: Oscar F [mailto:[EMAIL PROTECTED]]

I'm pretty sure it's not $_SERVER["QUERY_STRING"], it's
$_SERVER['QUERY_STRING'] (note the ' instead of ").

HTH.

  Oscar F.-

Miles wrote:

> When trying to get $_SERVER["QUERY_STRING"] I am getting 'Undefined index
QUERY_STRING' error
>
> If there is a query string, e.g.  www.site.com/index.php?hello_world then
it IS defined.  So it seems that PHP is complaining about undefined
variables, rather than just outputting nothing.
>
> How can I fix this?  I've had no problems until i reinstalled php today...

--- End Message ---
--- Begin Message ---
[snip]
> For example I intend to have over 4,000 different charts covering well
> over 6,000 artists and over 26,000 singles and album titles. Could
mySQL
> and PHP cope with this demand?

Yes, easily. Make sure your tables are properly indexed. 

> I thought about having a table for Artists, one for Singles and then
one
> for Albums and a junction table coupling all of them together but I
> can't figure out how to do it.
> 
> Has anybody got any thoughts that could help me along the way?

Table one would be the artists. Here you could store their name, age,
etc. They would be assigned an ID to relate to their albums and songs. 

Artists Table:
Artist_id
Name
Age
Hometown
...

Table two would be an album table where you would list the albums name,
release date, etc. It would be related back to the artist of the album
by the artist_id. You wouldn't have to store number of songs here,
because you can count them out of the next table.

Album Table:
Album_id
Artist_id
Name
Release_date
...

This table would hold the songs off the albums and the singles. You
would use type to designate if the song is a single or off an album. If
it's off an album, then a_id would be the album_id that relates back to
the album and artist. If it's a single, then a_id would be the artist_id
of who had the single. 

Song Table:
Song_id
A_id
Type
Name
Length
Lyrics
...

That's my ideas on how to do it. There are many ways to do it, though.

---John Holmes...


--- End Message ---
--- Begin Message ---
John W. Holmes wrote:

>Song Table:
>Song_id
>A_id
>Type
>Name
>Length
>Lyrics
>...
>
>That's my ideas on how to do it. There are many ways to do it, though.
>
Totally agree with what John says. If the lyrics are long (as I assume 
they will be) then I'd probably hive the lyrics off into a table of 
their own with as many records as needed to make up one song. The song 
table would then become:

Song Table:
Song_id
A_id
Type
Name
Length
Lyric_id

and have a lyrics table such as:

Lyrics Table:
Lyric_id
sequence
text

The sequence would be an incrementing number (starting at 1 for each new 
lyric_id), so you could have many records per song. Index this table on 
lyric_id, sequence.

Make sure in your code that you maintain integrity between tables. That 
is, if you delete a record from the artists table, ensure you delete 
relevant records from the others too.

Just my 2p (I'm in the UK, so not even EuroZone, yet).

HTH
Chris

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

 > >Song Table:
 > >Song_id
 > >A_id
 > >Type
 > >Name
 > >Length
 > >Lyrics
 > >...
 > >
 > >That's my ideas on how to do it. There are many ways to do 
 > it, though.
 > >
 > Totally agree with what John says. If the lyrics are long 
 > (as I assume 
 > they will be) then I'd probably hive the lyrics off into a table of 
 > their own with as many records as needed to make up one 
 > song. The song 
 > table would then become:
 > 
 > Song Table:
 > Song_id
 > A_id
 > Type
 > Name
 > Length
 > Lyric_id
 > 
 > and have a lyrics table such as:
 > 
 > Lyrics Table:
 > Lyric_id
 > sequence
 > text

Hmm, just thinking about normalizing the data and I suspect that the
song table will be insufficient if you have to take into account songs
that are released as a single and then also released on an album.  You
may find, in that circumstance, that having lookup tables will help.
One of these tables will contain artist ID's and associated song ID's
and enable you to get singles for an artist.  The other table would
contain album ID's and song ID's and enable you to get songs for an
album.  Obviously, you can get much more complex queries going as well
such as the number of times a particular song has been included on an
album by an artist.

This addition would also help with songs on compilation albums by
multiple artists where you could drill down to a list of songs on a
compilation album complete with the artist for each song.

CYA, Dave



--- End Message ---
--- Begin Message ---
Indeed, another problem I have is that if a single is on an album, which
track it is on the album.

I want to centre the site on the Charts that are generated weekly for
singles and albums so if I use that as my source for the lookup and then
have the data contained in separate fields that are linked to this
table. Will that be making things easier or harder?

-----Original Message-----
From: David Freeman [mailto:[EMAIL PROTECTED]] 
Sent: 13 October 2002 22:12
To: [EMAIL PROTECTED]
Subject: RE: [PHP] A little help needed, I cant figure!


 > >Song Table:
 > >Song_id
 > >A_id
 > >Type
 > >Name
 > >Length
 > >Lyrics
 > >...
 > >
 > >That's my ideas on how to do it. There are many ways to do 
 > it, though.
 > >
 > Totally agree with what John says. If the lyrics are long 
 > (as I assume 
 > they will be) then I'd probably hive the lyrics off into a table of 
 > their own with as many records as needed to make up one 
 > song. The song 
 > table would then become:
 > 
 > Song Table:
 > Song_id
 > A_id
 > Type
 > Name
 > Length
 > Lyric_id
 > 
 > and have a lyrics table such as:
 > 
 > Lyrics Table:
 > Lyric_id
 > sequence
 > text

Hmm, just thinking about normalizing the data and I suspect that the
song table will be insufficient if you have to take into account songs
that are released as a single and then also released on an album.  You
may find, in that circumstance, that having lookup tables will help.
One of these tables will contain artist ID's and associated song ID's
and enable you to get singles for an artist.  The other table would
contain album ID's and song ID's and enable you to get songs for an
album.  Obviously, you can get much more complex queries going as well
such as the number of times a particular song has been included on an
album by an artist.

This addition would also help with songs on compilation albums by
multiple artists where you could drill down to a list of songs on a
compilation album complete with the artist for each song.

CYA, Dave




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


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

 > Indeed, another problem I have is that if a single is on an 
 > album, which track it is on the album.

Off hand, I'd say that if you need this information as well (ie. You
want to recreate the "songs on album" list in the correct order) then
you need to extend one of your tables to include this information.  I'd
be looking to include album order in the song id, album id lookup table
and then using that column for sorting.

 > I want to centre the site on the Charts that are generated weekly for
 > singles and albums so if I use that as my source for the 
 > lookup and then
 > have the data contained in separate fields that are linked to this
 > table. Will that be making things easier or harder?

There's no easy answer to that.  Much depends on what information you
want to be able to derive from the raw data.  If all you need is to be
able to drag out weekly charts then your database schema need not be all
that complex.  If you want to make it possible to cross reference
between singles and albums and let people, for example, find out which
album a single was on when they are looking at a singles chart then
you'll certainly need more information.  Ultimately, it's going to be a
trade-off between the information you want to be able to provide and the
complexity of the database to provide that capability.

CYA, Dave



--- End Message ---
--- Begin Message ---
> I have loaded an html file into a string.  How can I search the string
for
> newlines/linefeeds? I know they are there, because if I echo the
string
> and
> view source in the browser, some tags are on new lines.
> 
> Example:
> <html>
> 
> <head>
> </head>

And do what when you find them? If you just want to know if there are
newlines in the file, then use strstr(). If you want to remove or
replace them, then use str_replace(). If you want to add in a <br> where
some newlines are, then use nl2br().

---John Holmes...


--- End Message ---
--- Begin Message ---
Thanks everyone.  I'' be breaking the string after the newline so that I can
convert the html to php echos and write them to a file.

-Shawn

"John W. Holmes" <[EMAIL PROTECTED]> wrote in message
000d01c272c1$544444d0$7c02a8c0@coconut">news:000d01c272c1$544444d0$7c02a8c0@coconut...
> > I have loaded an html file into a string.  How can I search the string
> for
> > newlines/linefeeds? I know they are there, because if I echo the
> string
> > and
> > view source in the browser, some tags are on new lines.
> >
> > Example:
> > <html>
> >
> > <head>
> > </head>
>
> And do what when you find them? If you just want to know if there are
> newlines in the file, then use strstr(). If you want to remove or
> replace them, then use str_replace(). If you want to add in a <br> where
> some newlines are, then use nl2br().
>
> ---John Holmes...
>
>


--- End Message ---
--- Begin Message ---
Just a quick addition, both the submit/link were very basic, they both
worked like this


$location = "/cgi-bin/getmailtest.cgi";
// $location = "getmail.php";
echo "$location<br>";
print("<a href=$location>Click here to test the cgi</a><br>\n");

print("<form name=form1 method=post action=$location>");
print("press the button to try the cgi as a redirect this way<br>");
print("<input type=submit value=\"try it\">");

(that was because I was messing round with differing locations of the cgi,
different extensions etc.. made it easier to set the actual cgi as a
variable, thats all)

Eventually if I can get this to work, it will have to accept a variable as
well being passed (the identifier), something like
getmailtest.cgi?id=$identifier

Thanks again

Hope someone can help

David Cook




--- End Message ---
--- Begin Message ---
Without seeing your code... only one guess: what are the permissions on
the file like? When you're running the script from the web server,
you're running it as the user under which the web server is running
(usually nobody or apache if you're using Apache on Linux), and this
causes problem if that particular user doesn't have access to the file.

There are very few solutions to this problem (at least as far as I
know). One is the suexec module for Apache, that lets you impersonate
root or another user, but you have to be *extremely* careful with the
permissions. The other is to change the default permissions of the file
so that everyone can delete and modify it, but that might not work well
for your needs. Yet a third one would be to impersonate directly from
PHP, for example through a call to su, but there are pitfalls there as
well.

Hope this helps.

On Sun, 2002-10-13 at 02:37, David Cook wrote:
> Hi all,
> 
> Got a question regarding using php scripts as cgi's.
> 
> What I am trying to do is this. (ya may need a bit of background, it gets a
> little complicated... well for me its complicated)
> 
> Im building a web based email system using php (duh) as the front end and
> glue for everything, part of it is using a program called getmail to
> retreive remote pop accounts to the virtual accounts on the server (its all
> virtual using qmail/vpopmail and courier-imap). The various setttings for
> this are in a file called getmailrc, in the virtual users home dir, (this
> will also be theoretically relevant when I try and do the same thing with a
> server side filtering program called maildrop.. but one at a time I reckon
> :))
> 
> ie. /home/vpopmail/domains/some.email.domain/someuser/.getmail/getmailrc
> 
> This file is owned specifically by a user/group otherwise getmail wont work
> 
> ie: -rw-r--r--    1 vpopmail vchkpw        585 Sep 29 07:16 getmailrc
> 
> any permissions other than this will tweak getmails internal security and
> stop it.
> 
> I decided to minimise security problems and use mysql as an intermidiary
> storage for any rules created for getmail, which works fine. :) (yay me..
> lol)
> 
> NOW comes the problem, I need to write (overwrite) that getmailrc file after
> the user has finished messing with their settings, to do this I decided that
> since the file can only be read/written to by the vpopmail/vchkpw
> user/group, that I would knock up a php script to run as a cgi, that would
> do only one thing: Upon a button being pressed to 'finish edit' the new
> rules would be written to the mysql table, then the cgi would be invoked
> with a particular identifier so that it could then look up the mysql table
> (using that identifier so it gets the right rows), and following some rules
> inbuilt, write out the getmailrc file with that restrictive permissions set.
> 
> I wrote up a script that was just for POC, that would get the data for where
> that file was supposed to be (the /home/vpopmail/etc...etc) and read it,
> then break out the various details and display it, basically just showing me
> what was already in the file. (using the shebang method, as my php cgi
> interpreter is OUTSIDE the web tree, but thats another story of getting the
> damn thing to work at all... damn RPM'S sometimes...
> that --enable-force-redirect had me stuck for a few days)
> 
> When I tested it out from the shell, using ./getmailtest.cgi as root, it
> worked, in that it did what it was sposed to.. display the contents of the
> getmailrc file. This cgi php script is owned by vpopmail/vchkpw which should
> allow reading the file as said above
> 
> Great, thought I, and proceeded to attempt linking to it from within the
> editing script, using both an attempt with a 'submit' button and a click
> through link.
> 
> Now comes the prob, it fails, with an error of being unable to either open
> the file, or that the file doesnt exist (depending on what I fiddle with in
> the script).
> 
> Would anyone have any ideas as to what may be going wrong here? I havent
> tried doing this before, using php as a cgi to do stuff to files on the
> system, so I am at quite a loss, and any help would be appreciated.
> 
> Regards
> 
> David Cook
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
Hi Marco

Thanks for the tips, they were what I was thinking was the problem, that
even when the php cgi was owned by the correct user, that if it was being
called via another web based script, that it would be executed as apache (in
this case) rather than the actual owner of the cgiscript (vpopmail/vchkpw),
the same ower/group as the target file. I had thought that if I used
setuid/gid on the cgi script that it would execute as that user, rather than
apache tho.

I didnt want to waste even more bandwidth by posting the code and all the
other details, I had hoped I had provided enough for some educated guesses
which may have led me to a solution, or what details to provide to help in a
solution

As I said, this was the first time I had attempted this precise situation
(that of executing a script as another user other than the web server), I
cant change the permissions on the getmailrc file, or the getmail program
wont read it, a bit of a catch 22 :( it seems.

> Without seeing your code... only one guess: what are the permissions on
> the file like?

The actual php cgi??? its
[root@alpha cgi-bin]# ls -lA get*
-rwxrwxr-x    1 root     root         6107 Oct 13 00:44 getmailtest.cgi

but I have messed with it, trying different combos including vpopmail:vchkpw
(the target file owner) all set as world executable

the permissions on the getmailrc file (the target file) are in my original
post.... but to show it again, it is
-rw-r--r--    1 vpopmail vchkpw        585 Sep 29 07:16 getmailrc

> When you're running the script from the web server,
> you're running it as the user under which the web server is running
> (usually nobody or apache if you're using Apache on Linux), and this
> causes problem if that particular user doesn't have access to the file.
which is why I thought (stressing thought.. like I said.. Ive never tried
this approach before) that the setuid/gid may have been the solution,
although testing did appear to indicate that it was executed as the web
server user when it is accessed via a click or button from the web, ignoring
the setuid etc...Like I was saying I may be trying somethign that is really
tough, but basically I wanted to partition out the part of the process that
may have security implications, and just pass a single variable to it,
executing it on demand, rather than via cron (though it does work via cron..
its not the best solution in my case.. but may be one I have to look at)
>
> There are very few solutions to this problem (at least as far as I
> know). One is the suexec module for Apache, that lets you impersonate
> root or another user, but you have to be *extremely* careful with the
> permissions. The other is to change the default permissions of the file
> so that everyone can delete and modify it, but that might not work well
> for your needs. Yet a third one would be to impersonate directly from
> PHP, for example through a call to su, but there are pitfalls there as
> well.

Even though I would reallyyy prefer NOT to go anywhere near su (cause
security is my primary focus in splitting out any file system writes to a
separate process) how would using su help out??? I havent done that either
so far (have never run into a situation like this before)

Thanks again for the reply... I will keep working on it.. and post back if I
get any further

Regards

David Cook


--- End Message ---
--- Begin Message ---
Hi David--

If that is the issue then I would suggest looking into the suexec module
for Apache...as long as you're very careful with the permissions, you
should be fine!

Also, my reference to the code was more a "caveat" than anything else.
In your case, if the script was working from the sell, imho you made a
good decision not to post the source, since the problem was clearly
somewhere else.

Marco

On Sun, 2002-10-13 at 11:20, David Cook wrote:
> Hi Marco
> 
> Thanks for the tips, they were what I was thinking was the problem, that
> even when the php cgi was owned by the correct user, that if it was being
> called via another web based script, that it would be executed as apache (in
> this case) rather than the actual owner of the cgiscript (vpopmail/vchkpw),
> the same ower/group as the target file. I had thought that if I used
> setuid/gid on the cgi script that it would execute as that user, rather than
> apache tho.
> 
> I didnt want to waste even more bandwidth by posting the code and all the
> other details, I had hoped I had provided enough for some educated guesses
> which may have led me to a solution, or what details to provide to help in a
> solution
> 
> As I said, this was the first time I had attempted this precise situation
> (that of executing a script as another user other than the web server), I
> cant change the permissions on the getmailrc file, or the getmail program
> wont read it, a bit of a catch 22 :( it seems.
> 
> > Without seeing your code... only one guess: what are the permissions on
> > the file like?
> 
> The actual php cgi??? its
> [root@alpha cgi-bin]# ls -lA get*
> -rwxrwxr-x    1 root     root         6107 Oct 13 00:44 getmailtest.cgi
> 
> but I have messed with it, trying different combos including vpopmail:vchkpw
> (the target file owner) all set as world executable
> 
> the permissions on the getmailrc file (the target file) are in my original
> post.... but to show it again, it is
> -rw-r--r--    1 vpopmail vchkpw        585 Sep 29 07:16 getmailrc
> 
> > When you're running the script from the web server,
> > you're running it as the user under which the web server is running
> > (usually nobody or apache if you're using Apache on Linux), and this
> > causes problem if that particular user doesn't have access to the file.
> which is why I thought (stressing thought.. like I said.. Ive never tried
> this approach before) that the setuid/gid may have been the solution,
> although testing did appear to indicate that it was executed as the web
> server user when it is accessed via a click or button from the web, ignoring
> the setuid etc...Like I was saying I may be trying somethign that is really
> tough, but basically I wanted to partition out the part of the process that
> may have security implications, and just pass a single variable to it,
> executing it on demand, rather than via cron (though it does work via cron..
> its not the best solution in my case.. but may be one I have to look at)
> >
> > There are very few solutions to this problem (at least as far as I
> > know). One is the suexec module for Apache, that lets you impersonate
> > root or another user, but you have to be *extremely* careful with the
> > permissions. The other is to change the default permissions of the file
> > so that everyone can delete and modify it, but that might not work well
> > for your needs. Yet a third one would be to impersonate directly from
> > PHP, for example through a call to su, but there are pitfalls there as
> > well.
> 
> Even though I would reallyyy prefer NOT to go anywhere near su (cause
> security is my primary focus in splitting out any file system writes to a
> separate process) how would using su help out??? I havent done that either
> so far (have never run into a situation like this before)
> 
> Thanks again for the reply... I will keep working on it.. and post back if I
> get any further
> 
> Regards
> 
> David Cook
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
There are a few PHP calendars:

http://www.cascade.org.uk/software/php/calendar/index.php

for example, that you can start from. It should be relatively easy then
to write a small table that contains just one field:

Date (datetime)

All you do is insert a row in the db for each day that is booked and
then whenever you have to check just hit the database: if there is a row
corresponding to the day you're checking, then the day is booked,
otherwise it isn't.

This is kind of the short version, but hopefully it should give you
enough to get going!

Cheers,


Marco

On Sun, 2002-10-13 at 07:48, Ray Healy (Data Net Services) wrote:
> Hi All
> 
> I have been trying to write a database and scripts for a calendar that shows which 
>days are booked and have failed at each point.
> 
> What i would like it to do is to show a calendar which have the dates that are 
>booked in a cell which are colour coded (say red) when it is unavailable and say 
>white when available.
> 
> The admiministartor should be able to enter multiple dates at a time (say a holiday 
>is booked for 5 days). perhaps a section for nortes that is only available for admin 
>use only would be handy.
> 
> An option to view 2 months at a time or perhaps the whole year would also be nice.
> 
> I have downloaded various scripts and tried to write my own but I cannot seem to be 
>able to enter multiple dates or colour code the output.
> 
> Can anyone help me or perhaps someone already has a script & database that does this 
>and would be willing to share.
> 
> Otherwise it there a script already out there that will do this - all the one that I 
>can find seem to do too much by allowing multiple users and storing a lot more data 
>which is something I do nort need.
> 
> Any help would be appreciated as I am tearing my hair out at the moment.
> 
> Thanks for your time
> 
> Ray Healy


--- End Message ---
--- Begin Message ---
If I want to use sql to access MS Access's database, is it necessary to have
mssql server?


--- End Message ---
--- Begin Message ---
> If I want to use sql to access MS Access's database, is it necessary
to
> have
> mssql server?

No, just open up Access and go to town...

Now, if you mean you want to get to Access from PHP, then you still
don't need MSSQL. You can connect to Access using ODBC or COM.

---John Holmes...


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

Does anybody have a working example of doing the lists of 'People who
searched this also searched this!' that I see on Amazon and other
websites.

Any help much appreciated!

Randum Ian
[EMAIL PROTECTED]
DJ / Reviewer / Webmaster, DancePortal (UK) Limited 
DancePortal.co.uk - Global dance music media



--- End Message ---
--- Begin Message ---
By Using mssql_<command>???


--- End Message ---
--- Begin Message ---
søn, 2002-10-13 kl. 01:48 skrev Jochen Kächelin:

> I tried to compile PHP with OpenSSL (0.96g) support with
> --with-openssl=/usr/src/web/openssl/current
> the way I did it since 4.1.0.

> I  always  get  the  message,  that  php  can't  find  the  openssl
> include-files.
 
> Any suggestions?

See if you have /usr/include/openssl . Which you most probably don't
have. If not, do: 'ln -s /usr/local/ssl/include/openssl
/usr/include/openssl' .

Best,

Tony

-- 

Tony Earnshaw

"There are many people who can't face the truth ... If you rob a
normal person of life's lies, at the same time you'll be robbing
him of his happiness."

>From Henrik Ibsen's "Vildanden", "The wild Duck."

e-post:         [EMAIL PROTECTED]
www:            http://www.billy.demon.nl




--- End Message ---
--- Begin Message ---
Hello
Trying to send a html email to 5000 people on a list
Keep getting Fatal error: Maximum execution time of 30 seconds exceeded 
Any pointers on the best way to achieve this lengthily operation without
the script failing? Best regards Scott

--- End Message ---
--- Begin Message ---
www.php.net/set_time_limit

---John Holmes...

> -----Original Message-----
> From: scott [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, October 13, 2002 2:06 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Fatal error: Maximum execution time of 30 seconds
exceeded
> 
> Hello
> Trying to send a html email to 5000 people on a list
> Keep getting Fatal error: Maximum execution time of 30 seconds
exceeded
> Any pointers on the best way to achieve this lengthily operation
without
> the script failing? Best regards Scott
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



--- End Message ---
--- Begin Message ---
In you php.ini, find max_execution_time = 360 and up it.

-Peter

> -----Original Message-----
> From: scott [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, October 13, 2002 20:06
> To: [EMAIL PROTECTED]
> Subject: [PHP] Fatal error: Maximum execution time of 30 seconds
> exceeded 
> 
> 
> Hello
> Trying to send a html email to 5000 people on a list
> Keep getting Fatal error: Maximum execution time of 30 
> seconds exceeded 
> Any pointers on the best way to achieve this lengthily 
> operation without
> the script failing? Best regards Scott
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
--- End Message ---
--- Begin Message ---
scott wrote:

>Hello
>Trying to send a html email to 5000 people on a list
>Keep getting Fatal error: Maximum execution time of 30 seconds exceeded 
>Any pointers on the best way to achieve this lengthily operation without
>the script failing? Best regards Scott
>
If the email is the same for all people on the list (i.e. not 
customised) then use the CC field and don't send 5000 emails. If they 
are customised then I'd recommend you queue them (fast) rather than wait 
whilst they are actually sent (normal). This can be done with sendmail 
and qmail, I assume other MTAs too. If you can't queue the emails then 
perhaps use cron (or at) to send them outside of a web page (you can 
still use PHP as CLI or with Lynx).

If you look through the archives this was discussed a month or so back 
in great detail. One thread was "PHP / Bulk Email" on 4th Sept, another 
"bulk mail()" and "sending 1000 emails to subscri.." both 12th June.

HTH
Chris


--- End Message ---
--- Begin Message ---
Yet another very fine way to do this job, is to set up a mailinglist manager 
(ezmlm i.e.), whom you subscribe all your recipients - And then send just one 
mail to the mailinglist manager.

Of course, works only if you got control to the server.

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

I have an image (selected via a form), I know the original size of this
picture 800x600. I'd like when I put the files in the database resize to
240x180, or 120x90. 

How do that ?


Bye


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

I'm having trouble adding mailparse to my PHP 4.2.3 install. 

I've downloaded and uncompressed mailparse-4.2.0.tgz into a subdir of my PHP directory 
and added "--enable-mailparse" to my config file but I'm still missing something.

What am I doing wrong?

Jeff



---------------------------------
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos, & more
faith.yahoo.com
--- End Message ---
--- Begin Message ---
Hello,

I'm running a script that inserts a form's contents into a MySQL table. However, when 
I insert the contents, I get an error telling me this:

Unknown column 'employee' in 'field list'

I can't find the problem. I have a field in my table called employee but I guess it 
doesn't see it. Any ideas why?

Thanks,
Stephen Craton
http://www.melchior.us
http://php.melchior.us
--- End Message ---
--- Begin Message ---
Print your SQL to the screen and verify it's value is what you think it
is. Make sure it's accessing the right table. 

---John Holmes...

> -----Original Message-----
> From: Stephen [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, October 13, 2002 5:03 PM
> To: PHP List
> Subject: [PHP] Odd Problem
> 
> Hello,
> 
> I'm running a script that inserts a form's contents into a MySQL
table.
> However, when I insert the contents, I get an error telling me this:
> 
> Unknown column 'employee' in 'field list'
> 
> I can't find the problem. I have a field in my table called employee
but I
> guess it doesn't see it. Any ideas why?
> 
> Thanks,
> Stephen Craton
> http://www.melchior.us
> http://php.melchior.us


--- End Message ---
--- Begin Message ---
Hi,
I've updated to PHP 4.2.3 and wrote this simple Script:

<?
if (isset($name)) {
    echo "Hallo $name";
}
else {
    echo "<FORM action='test.php' method=get>
    <input type=text name=name>
    <input type=submit name=action value=sendit>";
}
?>

I would expect the following:
The site starts with the form, then I enter my name (Lars) and click the
send-button. Then the script says Hello Lars.

The actual output is:
The site starts with the form, I enter my name and click the button, then
the form keeps being there, no "Hello"-message.

Has there changed something in PHP-Coding since I've learned it a few years
before?

There seems to be a diffrence between clicking the send button and pressing
Enter. Has this always been so?

regards
Lars



--- End Message ---
--- Begin Message ---
register_globals defaults now to off. Use the superglobals instead.
<?
if (isset($_GET['name'])) {
    echo "Hallo ".$GET['name'];
}
else {
    echo "<FORM action='test.php' method=get>
    <input type=text name=name>
    <input type=submit name=action value=sendit>";
}
?>

Sascha

Am Sonntag, 13. Oktober 2002 23:40 schrieb Lars H. Korte:
> Hi,
> I've updated to PHP 4.2.3 and wrote this simple Script:
>
> <?
> if (isset($name)) {
>     echo "Hallo $name";
> }
> else {
>     echo "<FORM action='test.php' method=get>
>     <input type=text name=name>
>     <input type=submit name=action value=sendit>";
> }
> ?>
>
> I would expect the following:
> The site starts with the form, then I enter my name (Lars) and click the
> send-button. Then the script says Hello Lars.
>
> The actual output is:
> The site starts with the form, I enter my name and click the button, then
> the form keeps being there, no "Hello"-message.
>
> Has there changed something in PHP-Coding since I've learned it a few years
> before?
>
> There seems to be a diffrence between clicking the send button and pressing
> Enter. Has this always been so?
>
> regards
> Lars

--- End Message ---
--- Begin Message ---
Sascha Cunz wrote this stuff back on Mon, 14 Oct 2002 00:09:58 +0200:

> register_globals defaults now to off. Use the superglobals instead.
> <?
> if (isset($_GET['name'])) {
>     echo "Hallo ".$GET['name'];
> }
> else {
>     echo "<FORM action='test.php' method=get>
>     <input type=text name=name>
>     <input type=submit name=action value=sendit>";
> }
> ?> 
> Sascha

The value of name for the submit button is wrong - it should be the same
as the value you gave the isset statement, in this case it should be
<input type="submit" name="name" value="sendit">
Better yet is to use isset($submit) and the value for the submit
statement is also name="submit" -
<input type="submit" name="submit" value="sendit">
of course value is optional. So you end up with this -

<?
if (isset($_GET['submit'])) 
        {
        echo "Hallo ".$GET['name'];
        }
else 
        {
        echo "<FORM action='test.php' method=get>
        <input type='text' name='name'>
        <input type='submit' name='submit' value='sendit'>";
        }
?> 
--
Chip

> Am Sonntag, 13. Oktober 2002 23:40 schrieb Lars H. Korte:
> > Hi,
> > I've updated to PHP 4.2.3 and wrote this simple Script:
> >
> > <?
> > if (isset($name)) {
> >     echo "Hallo $name";
> > }
> > else {
> >     echo "<FORM action='test.php' method=get>
> >     <input type=text name=name>
> >     <input type=submit name=action value=sendit>";
> > }
> > ?>
> >
> > I would expect the following:
> > The site starts with the form, then I enter my name (Lars) and click
> > the send-button. Then the script says Hello Lars.
> >
> > The actual output is:
> > The site starts with the form, I enter my name and click the button,
> > then the form keeps being there, no "Hello"-message.
> >
> > Has there changed something in PHP-Coding since I've learned it a
> > few years before?
> >
> > There seems to be a diffrence between clicking the send button and
> > pressing Enter. Has this always been so?
> >
> > regards
> > Lars
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
--- End Message ---
--- Begin Message ---
This beautifies it (even makes it a bit more secure), but one doesn't need it 
really; should have worked without these changes, too. (Of course, it's 
better to include these changes)

Sascha

> The value of name for the submit button is wrong - it should be the same
> as the value you gave the isset statement, in this case it should be
> <input type="submit" name="name" value="sendit">
> Better yet is to use isset($submit) and the value for the submit
> statement is also name="submit" -
> <input type="submit" name="submit" value="sendit">
> of course value is optional. So you end up with this -
>
> <?
> if (isset($_GET['submit']))
>       {
>       echo "Hallo ".$GET['name'];
>       }
> else
>       {
>       echo "<FORM action='test.php' method=get>
>       <input type='text' name='name'>
>       <input type='submit' name='submit' value='sendit'>";
>       }
> ?>

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

    I am calling a particular function.  Within that function I need access
to the $HTTP_GET_VARS array.  It seem I could only access that array if I
pass it as a parameter of the function.  Is this how it's supposed to work.
Thanks for any direction.  NOTE: I am using PHP 4.0.6.

  John Negretti
  www.ideablue.com



--- End Message ---
--- Begin Message ---
Try using 

global $HTTP_GET_VARS;

at the beginning of your function. $HTTP_GET_VARS has global scope, and
by default PHP isolates functions from the parent scope.


Marco

On Sun, 2002-10-13 at 16:39, John Negretti wrote:
> Hello All,
> 
>     I am calling a particular function.  Within that function I need access
> to the $HTTP_GET_VARS array.  It seem I could only access that array if I
> pass it as a parameter of the function.  Is this how it's supposed to work.
> Thanks for any direction.  NOTE: I am using PHP 4.0.6.
> 
>   John Negretti
>   www.ideablue.com
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
Anybody have reason for using $_SERVER['PHP_SELF'] -v- $_SERVER['URL'] ?
They both seem to always be the same in every instance I have seen so
curious is their is a preferance for one or the other and if there is a case
where PHP_SELF!=URL

Cheers,

-Peter

##################################
Peter Thoenen - Systems Programmer
Commercial Communications
Camp Bondsteel, Kosovo
##################################

"Stumbled Upon"...heh (Score:5, Funny) /.
by $carab on 23:00 23 August 2002 (#4131637)

"ForensicTec officials said they stumbled upon the military networks about
two months ago, while checking on network security for a private-sector
client."

Someone new to a Dvorak probably tried to type in "lynx
http://www.google.com"; but instead got "nmap -v -p 1-1024 -sS -P0 army.mil
-T paranoid".
--- End Message ---

Reply via email to