PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
d3ad1ysp0rk
Forum Donator
Posts: 1661 Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA
Post
by d3ad1ysp0rk » Wed Oct 22, 2003 5:45 pm
mail.php:
Code: Select all
<?PHP
if($refresh=="yes" && un!="")
{
session_start();
$_SESSION['mailcontent'] = $mailcontent;
$_SESSION['un'] = $un;
$_SESSION['refresh'] = $refresh;
header("location: mailfinish.php");
} ?>
<html>
<head>
<title>Email Page</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="<?PHP echo "$bgc"; ?>">
Email me without having to log into anything! Just fill out your message, and then your name or screen name and click submit! =)
<form name="mail" method="post" action="<?PHP echo "$PHP_SELF"; ?>">
<input type="textarea" name="mailcontent">
<input type="text" name="un" "size="25">
<input type="hidden" name="refresh" value="yes">
<input type="submit" name="submit" value="Send">
</form>
</body>
</html>
mailfinish.php:
Code: Select all
<html>
<body>
<?PHP
session_start();
if($mailcontent!="" && $un!="" && refresh=="yes")
{
mail("lppunkskater@hotmail.com", "Automated Scipt", "$mailcontent");
echo "Mail sent!";
}
else
{
echo "Error sending mail. IM LPpunkSkateR please.";
}
?>
</body>
</html>
I get this when I submit the form on mail.php:
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/des404/public_html/mailfinish.php:3) in /home/des404/public_html/mailfinish.php on line 4
Error sending mail. IM LPpunkSkateR please.
Anyone?
DuFF
Forum Contributor
Posts: 495 Joined: Tue Jun 24, 2003 7:49 pm
Location: USA
Post
by DuFF » Wed Oct 22, 2003 5:50 pm
Kriek
Forum Contributor
Posts: 238 Joined: Wed May 29, 2002 3:46 am
Location: Florida
Contact:
Post
by Kriek » Wed Oct 22, 2003 9:35 pm
mail.php
Code: Select all
<?php
ob_start();
$un = $_POSTї'un'];
$refresh = $_POSTї'refresh'];
$mailcontent = $_POSTї'mailcontent'];
if((strcmp($refresh, 'yes') == 0) && isset($un)) {
$dom = $_SERVERї'SERVER_NAME'];
$self = $_SERVERї'PHP_SELF'];
if(!headers_sent()) {
session_start();
$_SESSIONї'un'] = $un;
$_SESSIONї'refresh'] = $refresh;
$_SESSIONї'mailcontent'] = $mailcontent;
session_write_close();
header('Location: http://' . $dom . '/mailfinish.php');
exit();
}
}
?>
<HTML>
<HEAD>
<TITLE>Email Page</TITLE>
<LINK REL="stylesheet" HREF="style.css" TYPE="text/css">
</HEAD>
<BODY BGCOLOR="<?=$bgc?>">
Email me without having to log into anything! Just fill out your message, and
then your name or screen name and click submit! =)
<FORM NAME="mail" METHOD="post" ACTION="<?=$self?>">
<INPUT TYPE="textarea" NAME="mailcontent">
<INPUT TYPE="text" NAME="un" "size="25">
<INPUT TYPE="hidden" NAME="refresh" VALUE="yes">
<INPUT TYPE="submit" NAME="submit" VALUE="Send">
</FORM>
</BODY>
</HTML>
<?php
ob_end_flush();
?>
mailfinish.php
Code: Select all
<?php
ob_start();
?>
<HTML>
<HEAD>
<?php
if(!headers_sent()) {
session_start();
$un = $_SESSIONї'un'];
$refresh = $_SESSIONї'refresh'];
$mailcontent = $_SESSIONї'mailcontent'];
if(empty($mailcontent) || empty($un) || strcmp($refresh, 'yes') != 0) {
echo 'Error sending mail. IM LPpunkSkateR please';
} else {
mail('lppunkskater@hotmail.com', 'Automated Scipt', $mailcontent);
echo 'Mail sent!';
}
session_write_close();
}
?>
</BODY>
</HTML>
<?php
ob_end_flush();
?>
d3ad1ysp0rk
Forum Donator
Posts: 1661 Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA
Post
by d3ad1ysp0rk » Wed Oct 22, 2003 9:52 pm
I finished the script before checking back to this topic.
So here it is:
http://www.404-design.net/mail.php
I would change it, but I'm not sure what half the stuff you put is, and mine seems to be working fine.
mail.php
Code: Select all
<?PHP
if($refresh=="yes" && un!="")
{
session_start();
$_SESSION['mailcontent'] = $mailcontent;
$_SESSION['un'] = $un;
$_SESSION['refresh'] = $refresh;
echo "<meta http-equiv="refresh" content="0;URL=mailfinish.php">";
} ?>
<html>
<head>
<title>Email Page</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="#000000">
<form name="mail" method="post" action="<?PHP echo "$PHP_SELF"; ?>">
<table width="380" cellspacing="0" cellpadding="0" border="0">
<tr><td colspan="2" valign="top">Email me without having to log into anything! <br>Just fill out your message, and then your name or screen name and click submit!</td></tr>
<tr>
<td valign="top" width="110">Name or SN: </td>
<td valign="top" width="270"><input type="text" name="un" size="15"></td>
</tr>
<tr>
<td valign="top" width="110">Email Content: </td>
<td valign="top" width="270"><textarea name="mailcontent" cols="50" rows="5"></textarea></td>
</tr>
<tr>
<td><input type="hidden" name="refresh" value="yes"> </td>
<td valign="top" align="center"><input type="submit" name="submit" value="Send"></td>
</tr>
</table>
</form>
</body>
</html>
mailfinish.php
Code: Select all
<?PHP session_start(); ?>
<html>
<body>
<?PHP
if($mailcontent!="" && $un!="" && $refresh=="yes")
{
mail('lppunkskater@hotmail.com', 'Automated Scipt', '$mailcontent');
echo "Mail sent!";
}
else
{
echo "Error sending mail. IM LPpunkSkateR please.";
}
?>
</body>
</html>
Thanks everyone.