Re: [PHP-WIN] Concurrency issue on session file on harddisk

2008-02-12 Thread Michael Southworth
I should preface this by saying it has been a while since I have used php
extensively, but my suggestion would be to try putting in a delay at the
beginning of your PHPfile, before the session_start() command (or whichever
method you choose to begin your session). As far as I can recall, the
session needs to be initialized before any output is sent to the browser,
but this does not mean you cannot execute a php code delay before you start
the session. This may give you enough time for the other PHP request to
complete, freeing up the required file.

A potentially more robust, but equally untested option, would be to check
the file itself before initializing the session. The session_id will be
available in the super variables or via session_id(). Since the file names
for a given session are based predictably on this id, you could potentially
try to do a read access on the file.  If this fails, poll and try again or
timeout and fail gracefully. I am not very familiar with how the permissions
on this would play out though.

Those are two suggestions I could think of, hope that helps,
-Michael Southworth

On Feb 13, 2008 8:15 AM, Stephan Weiher <[EMAIL PROTECTED]> wrote:

> Thanks for the answer but this won't help us anyway. We cannot enable
> javascript on any computer in the company's network to make this issue
> going
> away. I'll need a way to delay the requests for one of the two frames
> (defined in the frameset) for a tiny amount of time to prevent two php.exe
> instances from accessing the session file at the same time. But I don't
> know
> how to do so. Javascript is no option for us and as far as I know HTML has
> no such mechanism. So I need another way. Perhaps sth. that delays the
> call
> of php.exe - but I/O must work on this way :)
>
> Greetings
> Stephan Weiher
>
>
>
> ""Jacob Kruger"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> news:[EMAIL PROTECTED]
> >A 'corny' workaround might be to get something like the nav frame in fact
> >to
> > then load the main frame using something like JavaScript - just a
> > thought -
> > since it would in fact first have rendered before the main frame was
> > loaded.
> >
> > You could then also put something like a 'waiting...' notice/string in
> the
> > main frame in case one or two people's machines in fact rendered/loaded
> > the
> > two frames in the wrong order.
> >
> > Stay well
> >
> > Jacob Kruger
> > Blind Biker
> > Skype: BlindZA
> > '...Fate had broken his body, but not his spirit...'
> >
> > - Original Message -
> > From: "Stephan Weiher" <
> > [EMAIL PROTECTED]>
> > To: <
> > php-windows@lists.php.net>
> > Sent: Tuesday, February 12, 2008 12:06 PM
> > Subject: [PHP-WIN] Concurrency issue on session file on harddisk
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP-WIN] Concurrency issue on session file on harddisk

2008-02-12 Thread Stephan Weiher
Thanks for the answer but this won't help us anyway. We cannot enable 
javascript on any computer in the company's network to make this issue going 
away. I'll need a way to delay the requests for one of the two frames 
(defined in the frameset) for a tiny amount of time to prevent two php.exe 
instances from accessing the session file at the same time. But I don't know 
how to do so. Javascript is no option for us and as far as I know HTML has 
no such mechanism. So I need another way. Perhaps sth. that delays the call 
of php.exe - but I/O must work on this way :)

Greetings
Stephan Weiher



""Jacob Kruger"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]
>A 'corny' workaround might be to get something like the nav frame in fact 
>to
> then load the main frame using something like JavaScript - just a 
> thought -
> since it would in fact first have rendered before the main frame was 
> loaded.
>
> You could then also put something like a 'waiting...' notice/string in the
> main frame in case one or two people's machines in fact rendered/loaded 
> the
> two frames in the wrong order.
>
> Stay well
>
> Jacob Kruger
> Blind Biker
> Skype: BlindZA
> '...Fate had broken his body, but not his spirit...'
>
> - Original Message - 
> From: "Stephan Weiher" <
> [EMAIL PROTECTED]>
> To: <
> php-windows@lists.php.net>
> Sent: Tuesday, February 12, 2008 12:06 PM
> Subject: [PHP-WIN] Concurrency issue on session file on harddisk 

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



[PHP-WIN] php: mail

2008-02-12 Thread Maria Oliveira
Im using this code to sent an email from the server to an email that the 
user write into a form, with a file attached, BUT it seems not to work.
It 'echo' the message 'Mail Sent' but im not reciving any email, i even 
check on my spam... not in gmail or yahoo or hotmail


Thanks!!!

$headers .= "\r\nContent-Type: multipart/mixed; 
boundary=\"PHP-mixed-".$random_hash."\"";

//read the atachment file contents into a string,
//encode it with MIME base64,
//and split it into smaller chunks
$attachment = chunk_split(base64_encode(file_get_contents($file)));
//define the body of the message.
ob_start(); //Turn on output buffering
?>
--PHP-mixed-
Content-Type: multipart/alternative; boundary="PHP-alt-$random_hash; ?>"


--PHP-alt-
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hello World!!!
This is simple text email message.

--PHP-alt-
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hello World!
This is something with HTML formatting.

--PHP-alt---

--PHP-mixed-
Content-Type: application/pdf; name="file.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment


--PHP-mixed---

//copy current buffer contents into $message variable and delete current 
output buffer

$message = ob_get_clean();
//send the email
$mail_sent = @mail( $to, $subject, $message, $headers );
//if the message is sent successfully print "Mail sent". Otherwise print 
"Mail failed"
echo $mail_sent ? "Mail sent to: ".$to : "Mail 
failed";

?>

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