I have been trying for a few days to obtain information about the users of sites. No success so far.
In flash I am using:
loadVariablesNum(“mailPHP.php”, “0”, “POST”);
My php code is:
<html>
<body>
<?php
$mail_to="northls@nbkayaking.com";
$browserType=$HTTP_USER_AGENT;
$mediaTypes=$HTTP_ACCEPT;
?>
</body>
</html>
I know I have made an arseup somewhere.
Who knows?
Cheers
[edit]by lostinbeta to show code…
Kaotic: Use [ PHP ] [ /PHP ] (without spaces) to show your HTML and PHP code since this forum converts that.[/edit]
system
January 4, 2003, 12:09am
2
I don’t know how Flash and PHP work together, it isn’t really my area, but I think the problem lies within your PHP script, it doesn’t look right to me. I just started learning PHP and created by own mailForm script, but I don’t know how to write one that will work with Flash like that.
system
January 4, 2003, 10:18pm
3
the correct .php file would be:
<?
$mail_to="northls@nbkayaking.com";
$browserType=$HTTP_USER_AGENT;
$mediaTypes=$HTTP_ACCEPT;
echo "mail_to=\"". $mail_to ."\"&browserType=\"". $browserType ."\"&mediaTypes=\"" . $mediaTypes . "\"";
?>
the thing is you have to print the content of the variables like this:
var=var_value
for multiple variables, you can use the ampersand (&) between variables, like this: var1=var_value1&var2=var_value2
and one more thing… in the .php file do not use <html> […] tags… print out only the variables and their content
have fun
system
January 4, 2003, 10:20pm
4
Even though it wasn’t me having the problems, I still want to thank you for that info.
I don’t work with server side flash, but am thinking about getting more into it, this is definitely good knowledge to have
system
January 4, 2003, 10:57pm
5
Thanks for the code. My only query is that I wanted the php file to generate an email. At the moment it only generates the code as shown in:
http://nortls.nbkayaking.com/BrowserConfig
I guess through the echo command
Would you have an idea how to use the mail() command to send the variables through email.
I seem to keep screwing the mail command up, getting errors such as:
Warning: Wrong parameter count for mail() in C:\Program Files\Apache Group\Apache2\htdocs est.php on line 11
Regards
system
January 5, 2003, 12:21am
6
the mail() php command prototype is like this:
bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]])
so, if you want to email ‘some1@yahoo.com’ with the subject ‘wassup’ and the message ‘hello there’, you would use:
if (@mail("some1@yahoo.com", "wassup", "hello there"))
echo 'email sent';
else echo "problems sending the email :/";
in your case, use:
if (@mail($mail_to,"subject",
"browser= " . $browserType . "<br>" .
"mediaTypes= " . $mediaTypes))
echo 'email sent';
else echo "problems sending the email :/";
and you’ll have an email with these things
hope i’m being usefull
system
January 5, 2003, 12:53am
7
… why wasnt this one moved to serverside scripting?
system
January 5, 2003, 12:57am
8
Very good question senocular. I didn’t even notice it was in the Actionscript section.
I moved it now.
system
January 5, 2003, 3:11am
10
Thanks for the good eye
[SIZE=1]::because as you can see I am missing one…lol::[/SIZE]
system
January 5, 2003, 3:08pm
11
OK my final php code is :
<?
$ToEmail = "northls@nbkayaking.com ";
$ToSubject = “Enquiry”;
$EmailBody = "Sent By: $FirstName
Senders Email: $Email
Message Sent:
$ToComments
";
$browserType=$HTTP_USER_AGENT;
$mediaTypes=$HTTP_ACCEPT;
mail($ToName." <".$ToEmail.">",$ToSubject, $EmailBody, “From: “.$FirstName.” <”.$Email.">");
?>
As you can see I have defined variables for browser type and media types. But I am having problems getting the values passed into the email. I get errors if I add thjem to the email body part of the mail command
Any pointers
Regards
system
January 5, 2003, 8:38pm
12
your code is a little bit confusing…
first, put the $browserType and $mediaTypes in $EmailBody.
second, what variable is $ToName ? you’ve used it as the first parameter in the mail() command: $ToName." <".$ToEmail.">".
if ($ToName) is not defined, then the mail() tried to send an email to an invalid address
i would explain you better, but i’m in a hurry… tomorrow i start school early
system
January 6, 2003, 9:22am
13
$ToName is a variable passed into the php script through flash. The real problem I have is adding additional variables, would this work as the php body?
$EmailBody = "Sent By: $FirstName
Senders Email: $Email
Message Sent:
$ToComments
$BrowserType=HTTP_USER_AGENT
$mediaTypes=$HTTP_ACCEPT
";
I am new to php coding and this is my first meaningful script therefore I am not sure about correct form of coding etc.
Regards
system
January 6, 2003, 1:13pm
14
I’ve had success with:
<html>
<body>
<?php
$ToEmail = "northls@nbkayaking.com ";
$ToSubject = “Enquiry”;
$BrowserType = $HTTP_USER_AGENT;
$MediaTypes = $HTTP_ACCEPT;
$ServerName= $REMOTE_ADDR. " " . $REMOTE_USER;
$EmailBody = "Sent By: $FirstName
Senders Email: $Email
MessageSent:
$ToComments
$BrowserType
$MediaTypes
$ServerName";
mail($ToName." <".$ToEmail.">",$ToSubject, $EmailBody, “From: “.$FirstName.” <”.$Email.">");
?>
</body>
</html>
Only trouble is that $HTTP_ACCEPT returns / and the BrowserType returns Mozilla rather than IE,
Any ideas?
system
January 6, 2003, 8:53pm
15
hmm… have no ideas on this one :((
anyone there who can help?
system
January 6, 2003, 8:58pm
16
hmm… it just popped out of my mind… you can use get_browser() for determining the browser type and some other stuff… maybe this will report the right browser;
i’ve searched right now on php.net about this function; look at the following example on how to use get_browser():
<?php
function list_array ($array) {
while (list ($key, $value) = each ($array)) {
$str .= "<b>$key:</b> $value<br>
";
}
return $str;
}
echo "$HTTP_USER_AGENT<hr>
";
$browser = get_browser();
echo list_array ((array) $browser);
?>
would write something like:
Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586)<hr>
<b>browser_name_pattern:</b> Mozilla/4\.5.*<br>
<b>parent:</b> Netscape 4.0<br>
<b>platform:</b> Unknown<br>
<b>majorver:</b> 4<br>
<b>minorver:</b> 5<br>
<b>browser:</b> Netscape<br>
<b>version:</b> 4<br>
<b>frames:</b> 1<br>
<b>tables:</b> 1<br>
<b>cookies:</b> 1<br>
<b>backgroundsounds:</b> <br>
<b>vbscript:</b> <br>
<b>javascript:</b> 1<br>
<b>javaapplets:</b> 1<br>
<b>activexcontrols:</b> <br>
<b>beta:</b> <br>
<b>crawler:</b> <br>
<b>authenticodeupdate:</b> <br>
<b>msn:</b> <br>
don’t worry about this example, because the browser in this test was really mozilla (the test was run under linux)
so try this function…
system
January 23, 2003, 1:05pm
17
Cold,
In a previous reply you used the echo command to display the results of my mailto() script. I would like to redirect users to another html page which will display the results of mailto().
The script I have used is:
<html>
<body>
<?php
$ToEmail = "northls@nbkayaking.com ";
$ToSubject = “Enquiry”;
$BrowserType = $HTTP_USER_AGENT;
$MediaTypes = $HTTP_ACCEPT;
$ServerName= $REMOTE_ADDR;
$Date= date("d/F/y
H.i");
$EmailBody = "Sent By: $FirstName
Senders Email: $Email
Message Sent:
$ToComments
$BrowserType
$MediaTypes
$ServerName
$Date";
mail($ToName." <".$ToEmail.">",$ToSubject, $EmailBody, “From: “.$FirstName.” <”.$Email.">");
if (@mail ($mail_to,“subject”,
"browser= " . $BrowserType . “” .
"mediaTypes= " . $MediaTypes)
header(“Location: http://evolt.org ”));
exit;
?>
</body>
</html>
The last section header … I have added.
It doesn’t work at the moment. How would the echo command work with the header line, or am I way off the mark.
Know anything about launching pop-ups with php??
regards
system
January 23, 2003, 6:21pm
18
Sorry that this question has been posted twice, I did it completely by accident.
system
January 23, 2003, 6:39pm
19
Completely all right. I took care of it for ya
system
January 23, 2003, 8:21pm
20
well, in case of succes, header() to .php page that says ‘email sent’ or something like this… otherwise, header() to a .php that says ‘not sent’;
furthermore, you can header() to a page like x.php?mailto=logik&browser=ie6 --i mean, transmit the parameters, and procces the $_POST parameters ( if(isset($_POST[‘mailto’])) echo … )
if you want to display what the mail contained in the page you’re redirecting… just put almost the same code with echo(), not with mail()
Know anything about launching pop-ups with php??
well, you can pop-up a window with javascript with the window.open() command
for further help, just let me know