PDA

View Full Version : Need some php advice



RizlaUK
04-12-2007, 11:52 PM
hey guys,

im in need of a small php script to send a email to a user after a payment has been received (kinda like the one Dermot uses for xdialog) once the paypal transaction is compleat the user is redirected to a page and enters there email address for the product download

iv been to hotscripts and but i cant seem to find what im looking for, can anyone point me in the right direction

rhosk
04-13-2007, 04:25 AM
<?php
mail("email@domain.com", "Subject", "Body Text");
?>
That is as simple as it gets. In your form, just use variables for the quoted areas and you should be all set :cool

RizlaUK
04-13-2007, 04:48 AM
is that all it takes, :eek:

ok, im gonner go and read up on some php, if its that easy then maybe ill make my whole site with it ;)

GoOgLe
04-14-2007, 03:26 PM
WHY DONT U TRY THIS JAVASCRIPT



<html>

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var good;
function checkEmailAddress(field) {
// the following expression must be all on one line...
var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.go v)|(\.org)|(\..{2,2}))$)\b/gi);
if (goodEmail) {
good = true;
}
else {
alert('Please enter a valid e-mail address.');
field.focus();
field.select();
good = false;
}
}
u = window.location;
m = "download link here";
function mailThisUrl() {
good = false
checkEmailAddress(document.eMailer.address);
if (good) {
// the following expression must be all on one line...
window.location = "mailto:"+document.eMailer.address.value+"?subject="+m+"&body="+document.title+" "+u;
}
}
// End -->
</script>

</HEAD>

<BODY>

<form name="eMailer">
E-MAIL DOWNLOAD LINK
<br>
Enter recipient's e-mail:
<br>
<input type="text" name="address" size="25">
<br>
<input type="button" value="Send Download URL" onClick="mailThisUrl();">
</form>

</body>

</html>

Imagine Programming
07-11-2008, 12:42 PM
php is safer:) if you use javascript you can just read the script out the source... not that save right?:P
i'm sorry that the script is dutch lol, but i placed some translating comment in it:)


<?php
/*Style*/
$style = "<html><head><title>Mailform</title><style>

body{
margin: 0;
padding:0;
background: #000000;
color: #FF0000;
background-repeat: repeat-x;
align: center;
text-align: center;
}

#header{
width: 100%;
height:60px;
margin: 0;
border: hidden;
border-width: 0 0 2px 0;
background-attachment : absolute;
background-repeat : no-repeat;
background-color : #000000;
text-align : right;
}

#bar{
width: 100%;
height:18px;
margin: 0;
top : 60px;
background-color : #000000;
border: #0033ff 2px solid;
border-left : hidden;
border-bottom : #0033ff 2px solid;
}

#left{
width: 80%;
float: left;
border: #0033ff solid;
border-width: 0 1px 2px 0;
color: #ff0000;
margin: 0;
padding: 0px;
font-weight: bold;
font: terminal;
}

#right{
width: 20%;
padding-left: 80%;
padding-right: 5px;
/* border: #ff3300 solid;
border-width: 0 0 0 0; */
color: #ff0000;
margin: 0;
padding: 0;
border: 0;
overflow: hidden;
}

body, input, textarea
{
font-size: 12px;
color: #ff3300;
font-family: Terminal;
size: 50;
align: center;
}
input, textarea
{
border: 1px solid blue;
background-color: #000000;
size: 50;
align: center
}

#IP{
font-family: Terminal;
font-weight: bold;
text-decoration: underline;
color: #F34145;
}
a:link{
color: #ff3300;
}

a:visited{
color: #0033ff;
}

a:hover{
color: #0000FF;
}

a:active{
color: #FF0000;
}
</style></head></html>\r\n\r\n";
/*End Style*/
echo $style;

if (IsSet($_POST['submit']))
{
$naam_ontvanger = $_POST['naar_naam']; //Reciever name
$email_ontvanger = $_POST['naar_emailadres']; //Reciever E-mail adress

$naam_verzender = $_POST['van_naam']; //Sender name
$email_verzender = $_POST['van_emailadres']; //Sender E-mail adress

$onderwerp = $_POST['onderwerp']; //subject
$bericht_verzender = $_POST['bericht_verzender']; //message


$headers = "From: ".$naam_verzender." <".$email_verzender.">\r\n"; //mail headers first is the name, second is the e-mail adress for replying
//--Message--\\
$bericht = "
Beste ".$naam_ontvanger.",

".$naam_verzender." Sends this with his silly php script

--------Message--------
".$bericht_verzender."
--------/Message--------
";
//--End Message--\\

mail($email_ontvanger, $onderwerp, $bericht, $headers); //mailing

echo
"<script language=\"JavaScript\">

var time = null
function move() {
window.location = 'http://location_of_mailscript_to_show_form_again.com'
}
//-->
</script>"; //Redirect script

echo "<body onload=\"timer=setTimeout('move()',2000)\">"; //Redirect after 2 seconds
echo 'mail was successfully sent!';

}
else
{
?> <center>
<br><br>
<form action="" method="post">
Naam ontvanger: <br><input type="text" name="naar_naam" align="center" style="width: 200px;"><br />
Email ontvanger: <br><input type="text" name="naar_emailadres" align="center" style="width: 200px;"><br /><br />
Naam verzender: <br><input type="text" name="van_naam" align="center" style="width: 200px;"><br />
Email verzender: <br><input type="text" name="van_emailadres" align="center" style="width: 200px;"><br /><br />
Onderwerp: <br><input type="text" name="onderwerp" align="center" style="width: 200px;"><br />
bericht:<br />
<textarea size='50' name="bericht_verzender" style="width: 200px; height: 150px;"></textarea>
<br /><br />
<input type="submit" name="submit" value="versturen">
</form>
</center>
<?php
}
?>