Re: [PHP] Re: Double entry into MySQL..

2003-01-09 Thread Marek Kilimajer
$_SERVER['REQUEST_METHOD'] contains the method used to retrieve the page 
(POST, GET etc, see rfc2616). HEAD method is used to retrieve info about 
a resource, but I'm not sure why, as Timothy stated, it does not always 
work.

Altug Sahin wrote:

Is this a php.ini or apache setting?

Marek Kilimajer [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 

You should be able to get around it also by checking
if $_SERVER[REQUEST_METHOD]=='HEAD'

Timothy Hitchens (HiTCHO) wrote:
   

 



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




Re: [PHP] Re: Double entry into MySQL..

2003-01-08 Thread Marek Kilimajer
You should be able to get around it also by checking
if $_SERVER[REQUEST_METHOD]=='HEAD'

Timothy Hitchens (HiTCHO) wrote:


When they first click on the file their browser will make a request for
type, size etc
then when it display's the dialog box on the screen of the client it
will make another
request to start the download.

I get around this by putting the session id into the database and if it
is double requested within
5 seconds to discard. So you will need to do a select, num_rows then if
below 1 insert.


Timothy Hitchens (HiTCHO)
Open Platform Consulting
e-mail: [EMAIL PROTECTED]

 

-Original Message-
From: Altug Sahin [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, 8 January 2003 2:07 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Double entry into MySQL..


Another strange behaviour... When I send the name of the file 
to be downloaded to this script, it works (still makes a 
double entry into MySQL
though) with GET method but it doesn't work if the file's 
name is sent with the POST method.

Why?  I am pulling my hair out here!!!

Please help...

Thanks again

Altug Sahin [EMAIL PROTECTED] wrote in message 
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   

Hi here,


 

I am sending a file to user's browser and logging the downloaded file 
   

into MySQL but everytime this script works, I see double 
 

entry in the 
   

MySQL table... Why is this happening?

Any ideas?

Thanks

?
$today = date(Y-m-d);

$conn = db_connect();

if(!$conn)
 echo Can't connect to database...;

$query = INSERT INTO track_dl (dldate, email, file)
   VALUES ('$today', '[EMAIL PROTECTED]', 'file.ext');

$result = mysql_query($query);

if(!$result)
 echo Can't execute query:  . mysql_error();

header(Content-type: application/pdf); readfile(file.pdf);
exit();
?


 


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

   



 



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




RE: [PHP] Re: Double entry into MySQL..

2003-01-08 Thread Timothy Hitchens \(HiTCHO\)
I wish it was as simple as that but in the past it just hasn't always
worked!!


Timothy Hitchens (HiTCHO)
Open Platform Consulting
e-mail: [EMAIL PROTECTED]

 -Original Message-
 From: Marek Kilimajer [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, 8 January 2003 7:29 PM
 To: Timothy Hitchens (HiTCHO)
 Cc: 'Altug Sahin'; [EMAIL PROTECTED]
 Subject: Re: [PHP] Re: Double entry into MySQL..
 
 
 You should be able to get around it also by checking
 if $_SERVER[REQUEST_METHOD]=='HEAD'
 
 Timothy Hitchens (HiTCHO) wrote:
 
 When they first click on the file their browser will make a 
 request for 
 type, size etc then when it display's the dialog box on the 
 screen of 
 the client it will make another
 request to start the download.
 
 I get around this by putting the session id into the 
 database and if it 
 is double requested within 5 seconds to discard. So you will 
 need to do 
 a select, num_rows then if below 1 insert.
 
 
 Timothy Hitchens (HiTCHO)
 Open Platform Consulting
 e-mail: [EMAIL PROTECTED]
 
   
 
 -Original Message-
 From: Altug Sahin [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, 8 January 2003 2:07 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: Double entry into MySQL..
 
 
 Another strange behaviour... When I send the name of the file
 to be downloaded to this script, it works (still makes a 
 double entry into MySQL
 though) with GET method but it doesn't work if the file's 
 name is sent with the POST method.
 
 Why?  I am pulling my hair out here!!!
 
 Please help...
 
 Thanks again
 
 Altug Sahin [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 
 
 Hi here,
 
 
   
 
 I am sending a file to user's browser and logging the 
 downloaded file
 
 
 into MySQL but everytime this script works, I see double
   
 
 entry in the
 
 
 MySQL table... Why is this happening?
 
 Any ideas?
 
 Thanks
 
 ?
  $today = date(Y-m-d);
 
  $conn = db_connect();
 
  if(!$conn)
   echo Can't connect to database...;
 
  $query = INSERT INTO track_dl (dldate, email, file)
 VALUES ('$today', '[EMAIL PROTECTED]', 'file.ext');
 
  $result = mysql_query($query);
 
  if(!$result)
   echo Can't execute query:  . mysql_error();
 
 header(Content-type: application/pdf); readfile(file.pdf); 
 exit(); ?
 
 
   
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
   
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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




Re: [PHP] Re: Double entry into MySQL..

2003-01-08 Thread Altug Sahin
Is this a php.ini or apache setting?

Marek Kilimajer [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 You should be able to get around it also by checking
 if $_SERVER[REQUEST_METHOD]=='HEAD'

 Timothy Hitchens (HiTCHO) wrote:

 When they first click on the file their browser will make a request for
 type, size etc
 then when it display's the dialog box on the screen of the client it
 will make another
 request to start the download.
 
 I get around this by putting the session id into the database and if it
 is double requested within
 5 seconds to discard. So you will need to do a select, num_rows then if
 below 1 insert.
 
 
 Timothy Hitchens (HiTCHO)
 Open Platform Consulting
 e-mail: [EMAIL PROTECTED]
 
 
 
 -Original Message-
 From: Altug Sahin [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, 8 January 2003 2:07 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: Double entry into MySQL..
 
 
 Another strange behaviour... When I send the name of the file
 to be downloaded to this script, it works (still makes a
 double entry into MySQL
 though) with GET method but it doesn't work if the file's
 name is sent with the POST method.
 
 Why?  I am pulling my hair out here!!!
 
 Please help...
 
 Thanks again
 
 Altug Sahin [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 
 
 Hi here,
 
 
 
 
 I am sending a file to user's browser and logging the downloaded file
 
 
 into MySQL but everytime this script works, I see double
 
 
 entry in the
 
 
 MySQL table... Why is this happening?
 
 Any ideas?
 
 Thanks
 
 ?
  $today = date(Y-m-d);
 
  $conn = db_connect();
 
  if(!$conn)
   echo Can't connect to database...;
 
  $query = INSERT INTO track_dl (dldate, email, file)
 VALUES ('$today', '[EMAIL PROTECTED]', 'file.ext');
 
  $result = mysql_query($query);
 
  if(!$result)
   echo Can't execute query:  . mysql_error();
 
 header(Content-type: application/pdf); readfile(file.pdf);
 exit();
 ?
 
 
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
 
 




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




RE: [PHP] Re: Double entry into MySQL..

2003-01-07 Thread Timothy Hitchens \(HiTCHO\)
When they first click on the file their browser will make a request for
type, size etc
then when it display's the dialog box on the screen of the client it
will make another
request to start the download.

I get around this by putting the session id into the database and if it
is double requested within
5 seconds to discard. So you will need to do a select, num_rows then if
below 1 insert.


Timothy Hitchens (HiTCHO)
Open Platform Consulting
e-mail: [EMAIL PROTECTED]

 -Original Message-
 From: Altug Sahin [mailto:[EMAIL PROTECTED]] 
 Sent: Wednesday, 8 January 2003 2:07 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: Double entry into MySQL..
 
 
 Another strange behaviour... When I send the name of the file 
 to be downloaded to this script, it works (still makes a 
 double entry into MySQL
 though) with GET method but it doesn't work if the file's 
 name is sent with the POST method.
 
 Why?  I am pulling my hair out here!!!
 
 Please help...
 
 Thanks again
 
 Altug Sahin [EMAIL PROTECTED] wrote in message 
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi here,
 
  
 I am sending a file to user's browser and logging the downloaded file 
  into MySQL but everytime this script works, I see double 
 entry in the 
  MySQL table... Why is this happening?
 
  Any ideas?
 
  Thanks
 
  ?
   $today = date(Y-m-d);
 
   $conn = db_connect();
 
   if(!$conn)
echo Can't connect to database...;
 
   $query = INSERT INTO track_dl (dldate, email, file)
  VALUES ('$today', '[EMAIL PROTECTED]', 'file.ext');
 
   $result = mysql_query($query);
 
   if(!$result)
echo Can't execute query:  . mysql_error();
 
  header(Content-type: application/pdf); readfile(file.pdf);
  exit();
  ?
 
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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