Re: Why wont my script mail in explorer, but ok in Firefox?



Jeff North wrote:
On Sat, 31 Jan 2009 06:38:26 -0800 (PST), in comp.lang.php Nosferatum
<John.Olav.O@xxxxxxxxx>
<5521501c-5902-490f-a416-885af53cf3a9@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:

| > > <?php
| > > session_start();
| >
| > > $_SESSION['MrMs'];
| > > $_SESSION['first_name'];
| > > $_SESSION['last_name'];
| > > $_SESSION['email_submitted'];
| >
| > > error_reporting(E_ALL);
| >
| > > $sendto = $_SESSION['email_submitted']; <====== REPORTED AS
| > > Undefined index: email_submitted
| >
| > > What does it mean? Is thsi the reason why it stops in explorer and not
| > > in firefox?

[sig snip]
| But, how is that done correctly?
| | From the form process I put the values in mysql and email the values
| to a given mail. The top of this page declare sessions, like: $_SESSION
| ['email_submitted']=$_POST['email_submitted']; (email_submitted is as
| post value from the form)
| Then redirects to the page which is causing me trouble, coffee in
| liters and headache. This page begins with <php session_start();
| Then I declare the session variables, like $sendto=$_SESSION
| ['email_submitted'];
| In the mail i use the variable $sendto as the recipent.
| Could this be a header problem?

The fact that the code works in one browser an not another indicates
it is a browser problem. Here are several things you should try. Try
them one at a time so you know where the problem lies.

On the above page add (this will show the state of the variables):
var_dump($_SESSION);
exit;


Your html code might be missing something.
<input type='text' name='email_submitted'> If the user doesn't place any text within this text box then it will
not be submitted. Change it to:
<input type='text' name='email_submitted' value=''>

On the page where you process your submitted data change:
$_SESSION['email_submitted']=$_POST['email_submitted'];
to
$_SESSION['email_submitted'] = isset($_POST['email_submitted']) ?
$_POST['email_submitted'] : "not set";

Replace $sendto = $_SESSION['email_submitted'];
with $sendto = isset($_SESSION['email_submitted']) ?
$_SESSION['email_submitted'] : "blank";


or better yet (not tested or reviewed for accuracy) -
if (!isset($_SESSION['email_submitted'])
{
echo "ERROR ON PAGE TRY AGAIN";
} else
$sendto = isset($_SESSION['email_submitted']) ? $_SESSION['email_submitted'] : "blank";
.....
blahblahblah...
}

The reason is that you would want to raise an error should this particular variable be empty anyway... because if it is emtpy - the rest of your processing will fail... I have a page that does something similar (get message, get email address, etc...) and I check all of the variables up front 1) to ensure it is not being used as a spam host (multiple "to" addresses) and 2) all of the fields are correctly filled in. But YMMV.


Remove the @ from : $ok = @mail($to,$subject,$message,$headers);

setting $to = $sendto = $_SESSION['email_submitted'] seems a little redundant but it is your code... I tend to try and keep it as simple as possible so that some second or third translation doesn't get lost along the way.



If the above fails then your cookies folder could be corrupted in IE.
Delete all cookies.

HTH
.



Relevant Pages

  • Full Disclosure for SQL-Ledger vulnerability CVE-2006-4244
    ... I have received many requests from security professions responsible for the ... Nor has he even expressed a substantive willingness to work with us to fix the problem. ... SQL-Ledger uses a fundamentally flawed approach to session authentication. ... For this reason, anybody can list login names and attempt to ...
    (Bugtraq)
  • Session variable being cleared--why?
    ... When I visit a specific web page, Request.aspx, for some reason my session ... Error 3 Error parsing attribute 'enablesessionstate': ... Any idea why I can't set this property or how to prevent the Session ... on a separate thought...Is there any easy way to log response times ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: background processes?
    ... >> JM> I'm not arguing with the presumed reason for having this ... > interactive command session, ... SSH author, ... If run $FOO over RSH, ...
    (comp.security.ssh)
  • Re: Cannot Close Excel Automation Process
    ... until the last Excel session is finished or until the program is ... it works just fine- - you can start up excel and shut it down just fine ... To me it looks like you simply by some detection of an error condition, ... or other test or some other reason - are not processing the close process. ...
    (alt.comp.lang.borland-delphi)
  • Re: Cant print locally after connecting to the network with RWW
    ... Simply trying to print too quickly after connecting the TS/RDP session ... RDP session the driver from the remote printer is loaded onto the controlled ... Another reason is that the User logging onto the controlled session (TS or ...
    (microsoft.public.windows.server.sbs)