Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 11-30-2022, 07:35 PM   #1
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana.
Posts: 652
Form to sendmail dynamic email?

I have a form that I'm using that currently works well using the following sendmail.php file:

Quote:
<?php
if(isset($_POST['email'])) {

// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "[email protected]";
$email_subject = "Subject";

}

// validation expected data exists
if(!isset($_POST['name']) ||
!isset($_POST['email']) ||
!isset($_POST['phone']) ||
!isset($_POST['page']) ||
!isset($_POST['message'])) {
}

$name = $_POST['name']; // required
$phone = $_POST['phone']; // required
$email = $_POST['email']; // required
$page = $_POST['page']; // required
$message = $_POST['message']; // required

$email_message = "Form details below.\n\n";

function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}

$email_message .= "name: ".clean_string($name)."\n";
$email_message .= "phone: ".clean_string($phone)."\n";
$email_message .= "email: ".clean_string($email)."\n";
$email_message .= "page: ".clean_string($page)."\n";
$email_message .= "message: ".clean_string($message)."\n";

// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
My question is this, how would I go about changing the above to dynamically change the $email_to field of the script?

What I'd like to be able to do is have a form on a page (with a unique id assigned to it) that will pull the user who uploaded the document to the databases registered email and, when the html form is filled out, it sends the email to them directly, without having to type their email address in the html form itself, does that make sense?

So if John submitted a document that is available on documents.php?id=123 it pulls his email from the registered user database (via the array if possible) and prefills the form (with a hidden field) so all my proofer has to do is fill out the message field and hit submit.

This is the current form HTML I'm using:

Quote:
<form action="https://www.domain.com/sendmail.php" method="post" class="wpcf7-form" novalidate="novalidate">
<input type="hidden" name="page" value="about"/>
<div style="display: none;">
</div>
<p>Your Name (required)<br/>
<span class="wpcf7-form-control-wrap your-name"><input type="text" name="name" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" aria-required="true" aria-invalid="false"/></span> </p>
<p>Your Phone (required)<br/>
<span class="wpcf7-form-control-wrap your-email"><input type="email" name="phone" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email" aria-required="true" aria-invalid="false"/></span> </p>
<p>Your Email (required)<br/>
<span class="wpcf7-form-control-wrap your-email"><input type="email" name="email" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email" aria-required="true" aria-invalid="false"/></span> </p>
<p>Your Message<br/>
<span class="wpcf7-form-control-wrap your-message"><textarea name="message" cols="40" rows="10" class="wpcf7-form-control wpcf7-textarea" aria-invalid="false"></textarea></span> </p>
<p>&nbsp;<br>
<input type="submit" value="Send" class="wpcf7-form-control wpcf7-submit"/></p>
<div class="wpcf7-response-output wpcf7-display-none"></div></form>
Is this even possible to do?
__________________
PublisherBucks
Wellness Affiliate Program.
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-01-2022, 03:26 PM   #2
zijlstravideo
Confirmed User
 
zijlstravideo's Avatar
 
Industry Role:
Join Date: Sep 2013
Location: The Netherlands
Posts: 805
Instead of using POST through a form to insert the user's email, you'll just get it from the database instead.

Check if user is logged in. If so, get the user's email from the database and set the variable.

You don't have to submit the email address (HTTP POST) using the form page, but rather verify and add the user's email address on the sendemail.php page. This will also prevent anyone who isn't logged in to the website, from sending a POST request to that link directly.

If you do the email address validation part on the form page, someone can just bypass the whole form page by making a direct POST request to the sendemail.php file directly (and abuse it to send spam).

Also, the code for your sendemail.php page isn't secure... at all!
__________________
Contact: email
zijlstravideo is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-01-2022, 06:34 PM   #3
fuzebox
making it rain
 
fuzebox's Avatar
 
Industry Role:
Join Date: Oct 2003
Location: seattle
Posts: 21,697
The questions are getting more and more basic.
fuzebox is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-01-2022, 09:24 PM   #4
plsureking
bored
 
plsureking's Avatar
 
Industry Role:
Join Date: Aug 2003
Location: Metaverse
Posts: 4,675
Quote:
Originally Posted by fuzebox View Post
The questions are getting more and more basic.
people keep answering this so he keeps posting here instead of googling.



#
__________________
#
plsureking is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-02-2022, 03:44 AM   #5
brassmonkey
Pay It Forward
 
brassmonkey's Avatar
 
Industry Role:
Join Date: Sep 2005
Location: Yo Mama House
Posts: 75,548
my post was erased LOL
__________________
EMAIL ==>[email protected] ==> #NOBIDEN2024
TRUMP 2024!!! | END DACA!!!! | HCR2060 <= ILLEGAL ALIENS!!!!...👮
=> TRUMPS PAYDAY!!!!... - Support The Laken Riley Act!!! - Trump Nobel Prize...
brassmonkey is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-03-2022, 11:52 AM   #6
Publisher Bucks
Confirmed User
 
Industry Role:
Join Date: Oct 2018
Location: New Orleans, Louisiana.
Posts: 652
Quote:
Originally Posted by zijlstravideo View Post
Also, the code for your sendemail.php page isn't secure... at all!
Yeah it isnt live yet, im just working on getting the basics setup, thank you ,thats exactly the info i was looking for too
__________________
PublisherBucks
Wellness Affiliate Program.
Publisher Bucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
form, email, html, field, required, registered, document, message, user, john, submitted, sense, address, helpme, pulls, hit, fill,  , submit, phone, current, proofer, database, array, hidden



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.