RE: [PHP] something wrong

2001-08-07 Thread Rich Cavanaugh

Ok, this is just a variant of a question asked almost daily. You are trying
to call a PHP function using JavaScript. PHP is handled on the server,
JavaScript is done client side. The browser doesn't know anything about PHP.
Another option might be to use the onunload handler to popup (might piss off
people though) a window which would load that PHP script and delete the
file.

rich



-Original Message-
From: Eduardo Kokubo [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 1:49 PM
To: Chris Cocuzzo
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] something wrong


I tried it using return and without it, but unfortunly  neither cases
worked.

- Original Message -
From: Chris Cocuzzo [EMAIL PROTECTED]
To: Eduardo Kokubo [EMAIL PROTECTED]
Sent: Tuesday, August 07, 2001 2:21 PM
Subject: Re: [PHP] something worong


 hey-

 I'm not sure, but maybe try this:

 body onunload=?php return apaga($diretorio);?

 for some reason i don't think that'd work, prolly because of the quotes
 around the php, however i think you need to call it that way. But can you
 ever use return that way??

 chris


 - Original Message -
 From: Eduardo Kokubo [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Tuesday, August 07, 2001 1:12 PM
 Subject: [PHP] something worong


 Hi,

 I'm using this code to delete a file using onunload, but this is not
 working. Can anyone please tell me why? I know the function apaga() works,
 but the onunload thing doesn't. I probably missed a detail.

 html
 head
 /head
 BODY onunload=return apaga($diretorio);
 ?php

 function apaga($diretorio){

 unlink ($diretorio.tgz);

 }





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] [OT-ish] Optional Extras.

2001-06-25 Thread Rich Cavanaugh

Dave,
I did something similar and I came up with an interesting way of
approaching it:

Assign IDs to each car (obviously).
Assign an ID to each option.
Match up your car IDs and option IDs in a seperate table.

Here's some table defs:

create table cars (
carid   int auto_increment,
namevarchar(255)
);

create table options (
optid   int auto_increment,
namevarchar(255)
);

create table caroptions (
carid   int,
optid   int
);

(if my sql is off, don't flame me, you at least get the idea)

Here's the search:

$words should be a comma delimited list if the options the user chose.

select count(o.carid) as cnt, o.carid as id, c.name from caroptions as o,
cars as c where and o.optid in ({$words}) and o.carid = c.carid group by
o.carid, c.name order by cnt DESC

This would give you a list of cars ordered by the best match to worst match.


again - this is all off the top of my head, I'm sure it's not word for word
correct.
--
Rich Cavanaugh

-Original Message-
From: Dave Mariner [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 25, 2001 3:54 PM
To: [EMAIL PROTECTED]
Subject: [PHP] [OT-ish] Optional Extras.


Please excuse me if you consider this to be off-topic, but this is the best
place I can think of to ask the (slightly long-winded) question.

Imagine you have a car database (MySQL driven). Different models have
different optional extras (air-con, central locking, immobiliser etc). I
need to store the optional extras in a searchable form - i.e. the customer
may have a wish-list of electric windows, aircon, and power steering.
However the optional extras list is not and will not be finalised when the
system goes live (probably will never be finalised!). Therefore I cannot do
the quick-and-dirty hack of putting all the options as binary fields in my
car database, so must come up with a more elegant solution. I've thought of
storing e.g. 10 tuples car.option1-aircon code, car.option2-powersteering
code. etc. and also going down the header-detail route.
My current quandry is to which is going to be better for the search
aspect, considering I'd also like to give them a best fit option. Would it
be to create a cursor on my fixed criterion (price, age etc) and then
iterate through each of those manually in my php script (see - it isn't
entirely off topic ;0) ) counting the matches for that record in the
optional-extra detail table? Or would it be to do a select where
(optionalextra1=mychoice1 or optionalextra2 = mychoice1 ..) and
(optionalextra2=mychoice2 or optionalextra2 = mychoice2.. ) and  etc
etc (yeuch!).

 I have a sneaking suspicion that there's a more elegant way than either
of these, but can't think of it at the moment.

 If you come up with the solution there's a beer in it for you the next
time you're in Paphos, Cyprus!

Thanks in advance,

Dave.




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] email templates and str_replace

2001-06-20 Thread Rich Cavanaugh

Richard,
The problem is with the str_replace()s. Consider the following:

?php
$myvar = 'this is a var.';
$mytext = str_replace('is', 'is not', $myvar);
?

At this point $myvar still equals 'this is a var.' but $mytext is 'this is
not a var.' $myvar hasn't been modfified by the str_replace so any
additional str_replace()s after it will not have a cumlative effect.

?php
$mail_content = $mail_template;

$mail_content = str_replace('##fullname##',$fullname,$mail_content);
$mail_content = str_replace('##email##',$email,$mail_content);
$mail_content = str_replace('##domain##',$domainname,$mail_content);
?

Something like the above would have the effect you're looking for.

--
Rich Cavanaugh
CTO, EnSpot.com

-Original Message-
From: Richard Kurth [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 20, 2001 4:32 AM
To: [EMAIL PROTECTED]
Subject: [PHP] email templates and str_replace


  I am trying to set up a template for an email program below you will
  see the test program the $mail_template is pulled from a database
  that is pre saved when it is saved the Placeholders are filled in
  using str_replace. that is what I want it to do. But it does not work.
What am
  I missing hear.

$mail_template= html
head
titleWeb Hosting At ##hostdomain## /title
/head

body bgcolor='#C4C9DB'
font size='4' color='#008080'strongDear ##fullname## /strong/font
brbr
font size='4' color='#008080'strongYour webhosting account has been
created. Please use the following data to log in to ##domain##
/strong/font
br
font size='4' color='#008080'
strongul type=square
liDomain:##domain##   /li
liIP-Address: ##ip## /li
liUsername: ##username##/li
liPassword: ##password##/li
liMysql Database: ##userdatabase##  /li
liMysql Username: ##newuser## /li
liMysql Password: ##newuserpass## /li
/ul  /strong
/font

font size='4' color='#008080'strongThanks for choosing ##hostdomain##
br Any Questions e-mail ##sales##@##hostdomain##/strong /font

/body
/html
;

/* message*/
//$mail_template = $message;

$fullname=Richard Kurth;
 $email=[EMAIL PROTECTED];
 $hostdomain=northwesthost.com;
 $hostname=www;
 $domain=twohot;
  $tld=.com;
 $baseip=234.444.45.444;
 $username=rkurth;
 $password=boat;
 $userdatabase=twohot;
 $newuser=twohot;
 $newuserpass=twohot;
 $sales=sales;
$domainname=$hostname . . . $domain . $tld;


$mail_content = str_replace('##fullname##',$fullname,$mail_template);
$mail_content = str_replace('##email##',$email,$mail_template);
$mail_content = str_replace('##domain##',$domainname,$mail_template);
$mail_content = str_replace('##ip##',$baseip,$mail_template);
$mail_content = str_replace('##username##',$username,$mail_template);
$mail_content = str_replace('##password##',$password,$mail_template);
$mail_content =
str_replace('##userdatabase##',$userdatabase,$mail_template);
$mail_content = str_replace('##newuser##',$newuser,$mail_template);
$mail_content = str_replace('##newuserpass##',$newuserpass,$mail_template);
$mail_content = str_replace('##hostdomain##',$hostdomain,$mail_template);
$mail_content = str_replace('##sales##',$sales,$mail_template);
/* and now mail it */
/* recipients */
$recipient = $fullname $email ;
//header
$headers .=From: Sales Department  [EMAIL PROTECTED] \n;
$headers .= reply-To:$from\nX-Mailer: PHP/ .phpversion(). \n;
$headers .= Content-Type: text/html; charset=iso-8859-1\n;
//subject
$subject1 = $subject;
//mail($recipient, $subject1, $mail_content, $headers);
//print $recipient, $subject1, $mail_content, $headers;
echo $mail_content;











Best regards,
 Richard
mailto:[EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Calculate # of minutes during working hours between two dates

2001-06-20 Thread Rich Cavanaugh

this is just the way I would do it:

generate timestamps for 8.00 and 17.30 for the days you want as long as the
timestamps are between the two original timestamps. after that it's all
subtraction and dividing by 60. That's about as efficient as I can think of.

Rich Cavanaugh

-Original Message-
From: Wim Koorenneef [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 20, 2001 11:26 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Calculate # of minutes during working hours between two
dates


Hi all,

I want to calculate the number of minutes between two dates, but only
those minutes on monday through friday between 08.00 and 17.30.

I could evaluate every minute in the interval against all known minutes
during working hours, but that's a bit much :-) Any suggestions for a
better, more efficient algorithm? Tia.

--
Greetinx,

Wim Koorenneef [EMAIL PROTECTED] Boxtel, the Netherlands


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Code check please

2001-06-20 Thread Rich Cavanaugh

You're using UPDATE syntax for your INSERT

try:

$sql = INSERT INTO tabell (fornamn, efternamn, email) values ('{$fornamn}',
'{$efternamn}', '{$email}');

Rich Cavanaugh

-Original Message-
From: Andreas Skarin [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 20, 2001 12:00 PM
To: PHP General
Subject: [PHP] Code check please


I've tried to get this working for over an hour
now, and it still won't. I don't even get an error
message to help me find the problem so I was
hoping that someone could check my code for me.

I'm fooling around with a basic form that is
supposed to send one's name, surname and e-mail
address to receive.php. receive.php is then
supposed to take the information and add it to a
table called tabell in a database called
databas, but it doesn't work. I think there
might be something wrong with my MySQL query.

- - - - - - - - - - - FORM - - - - - - - - - - - -
- -

form action=receive.php method=post
PFouml;rnamn:br
input type=text name=fornamn
size=25/p
pEfternamn:br
input type=text name=efternamn
size=25/p
pE-mailadress:br
input type=text name=email
size=25/p
input type=submit name=submit
value=Log in
/form

- - - - - - - - - - - - - - - - - - - - - - - - -
- - -

- - - - - - - - - - - RECEIVE.PHP - - - - - - - -
- - -

?php

// connection to MySQL
$connection = mysql_connect(localhost,
username, password);
if (!$connection) {
echo (PUnable to connect to the database
server at this time./P );
exit();
}

//select database
if (! @mysql_select_db(databas) ) {
echo (PUnable to locate the database at
this time./P);
exit();
}

// MySQL query
$sql = INSERT INTO tabell SET .
fornamn ='$fornamn', .
efternamn='$efternamn', .
email='$email';;
?

- - - - - - - - - - - - - - - - - - - - - - - - -
- - -

Thanks in advance!

// Andreas


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Problem starting session

2001-06-20 Thread Rich Cavanaugh

Ben,
In your php.ini you should have the following:

session.save_path = c:\winnt\temp

Currently you have it set to:

session.save_path = /tmp


--
Rich Cavanaugh
-Original Message-
From: Ben Edwards [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 23, 2001 12:48 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Problem starting session


I am getting the following on a Windows 2000 Professional installation when
I try to start a session:

Warning: open(/tmp\sess_9ab091b811c5675d90fabf4392b3c110, O_RDWR) failed: m
(2) in
e:\inetpub\wwwroot\cd\common.inc on line 27

Any help would be much appreciated.

Regards,
Ben
*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+
* Ben Edwards [EMAIL PROTECTED]+44 (0)7970 269 522 *
* Campaign Against proper English, Dyslexia division *
* Homepagehttp://www.gifford.co.uk/~bedwards *
* i-Contact Progressive Videohttp://www.videonetwork.org *
* Smashing the Corporate image http://www.subvertise.org *
* Bristol's radical newshttp://www.bristle.co.uk *
* Open Directory Project http://www.dmoz.org *
*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] how to install pws on win2k

2001-06-20 Thread Rich Cavanaugh



Sagar,
 Open your "Add/Remove Programs" control panel. Click on 
"Add/Remove Windows Components". Click the check box next to "Internet 
Information Server". Click OK. You'll need your Win2k CD. This will install a 
limited version of IIS. 

--Rich 
Cavanaugh

-Original 
Message-From: sagar chand 
[mailto:[EMAIL PROTECTED]]Sent: Wednesday, June 20, 2001 12:58 
PMTo: [EMAIL PROTECTED]Subject: [PHP] how to 
install pws on win2k

  hi everyone,
  
  I have recently shifted from win98 to win2k. the 
  pws i'm using is not installing on win2k. Is there any remedy 4 
  this?
  
  thanks for all u guys who help here with this 
  mailing list.
  
  bye
  sagar


RE: [PHP] Qmail problem

2001-03-08 Thread Rich Cavanaugh

Or you could try this:

sendmail_path   =   /var/qmail/bin/qmail-inject

Obviously you'll want to put in your correct path to qmail-inject, but that
works fine for me.

--
rich

-Original Message-
From: David Robley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 08, 2001 7:24 PM
To: pete collins; [EMAIL PROTECTED]
Subject: Re: [PHP] Qmail problem


On Fri,  9 Mar 2001 03:43, pete collins wrote:
 I keep getting:
 qmail-inject: fatal: read error

 I've tried everything.

 Sendmail is symlinked to /var/qmail/bin/sendmail wrapper

 $ ls -l /usr/lib/sendmail
 lrwxrwxrwx   1 root root   28 Aug 25  2000
 /usr/lib/sendmail - ../../var/qmail/bin/sendmail

 $ ls -l /usr/sbin/sendmail
 lrwxrwxrwx   1 root root   28 Aug 25  2000
 /usr/sbin/sendmail - ../../var/qmail/bin/sendmail


 I have tried every permutation for my sendmail_path in php.ini

 I tested the php code i'm using from my FreeBSD box which uses sendmail
 and it all works fine.

 I can use qmail fine from perl.

 Does anyone have any ideas? This is down right silly. ;-)

 Thanks

 --pete

For me, on Slackware, this works:

~$ ls -l /usr/sbin/sendmail
lrwxrwxrwx   1 root root   23 Aug 28  2000 /usr/sbin/sendmail
- /var/qmail/bin/sendmail*
~$ ls -l /usr/lib/sendmail
lrwxrwxrwx   1 root root   18 Jul 12  2000 /usr/lib/sendmail
- /usr/sbin/sendmail*

sendmail_path   =   /usr/sbin/sendmail -t -i;for unix only,
may supply arguments as well (default is sendmail -t)

Cheers
--
David Robley| WEBMASTER  Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet| http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]