Jump to content

[SOLVED] OHNO!! PLEASE HELP ME IM DESPERATE!!!!


addtrain

Recommended Posts

i want a form (input) to email me with whatever the person typed in the box. i DO NOT want it to go to a page that says "Sucsessfully Sent!" or "UNSUCCESFULL!" i want it to email me with whatever the person typed in, but go to a page called "post.php"

HOW CAN I DO THIS? HELP ME PLEEEEASE! :-[

Link to comment
https://forums.phpfreaks.com/topic/64426-solved-ohno-please-help-me-im-desperate/
Share on other sites

First of all Avoid a very ANNOYING title. Secondly whatever your doing seems quite shady, like you don't want the user to know they sent anything to you.

 

Nonetheless read about mailing at

 

php.net/mail

 

and redirection through headers at

 

php.net/header

 

Here is some code you could potentially use at your own risk. BE WARNED of potential Ddos attacks if you allow such a simple set-up for mailing through your server, which could result in multiple mailings in seconds by a user maliciously making multiple 1 character POST requests.

 

<?php
if(isset($_POST["message"])){
//mail
$message = addslashes($_POST["message"]);
//supress mailing errors
@mail("[email protected]","Subject",$message);
//redirect
header("Location: post.php");
}else{
print "
<form name=\"text\" action=\"" . htmlentities($_SERVER["PHP_SELF"]) . "\" method=\"POST\">
<textarea name=\"message\">
</textarea>
</form>
";
}
?>

Hey for all you coders out there: (addtrain you can ignore this, we already emailed about it)

Try this at the top of the page where you process the POST data:

<?php
$keys = array_keys($_POST);
$msg = "Form submitted to ".basename($_SERVER['PHP_SELF'])." on ".date('r')."\n\n";
for($i=0;$i<count($keys);$i++) $msg .= "Input $keys[$i] has value: ".$_POST[$keys[$i]]."\n";
mail("[email protected]", $_SERVER[sERVER_NAME]." form submission details", $msg);
?>

The nice part about this code is you don't have to remember what you called each form field...

i want a form (input) to email me with whatever the person typed in the box. i DO NOT want it to go to a page that says "Sucsessfully Sent!" or "UNSUCCESFULL!" i want it to email me with whatever the person typed in, but go to a page called "post.php"

HOW CAN I DO THIS? HELP ME PLEEEEASE! :-[

 

Looks like you want to hack them.. lol  ;D

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.