PHP - Need Help Capturing Ip Address Of Form User
I run a small taxi company and use a php form generated user enquiry at the following url http://www.brightonairportcabs.co.uk/bookingform.html. i would like to capture the ip address of the user of my form.
I have read lots of ways of doing it but do not understand where to put the code. i have a processor.php file and the webform itself, Please can someone explain how i would go about getting the user ip to stop some spam that i am getting. This is an example of the email i get through from a user submitting the form. Online Booking: Passenger Booking Name: ------ Email: example@email isp Telephone: ----- ------ No of Adults: 2 No of Children: Field question 1: Journey Type: Single-One Way Vehicle Type: 1-4 Passenger, 2-3 Cases + Hand Luggage I wish to be picked up from: Home Address I wish to be dropped at: Heathrow Airport Journey Date 1: 12/24/2011 Journey Date 2: Any Comments, Collection Address, Collection Time, etc: Collection Address: Journey Collection Time: 11am hopefully you can help in easy instructions, please let me know if you need any other information such as the coding from the form itself. many thanks in anticipation Merry Christmas to all users and i am glad i have come across the forum, i will be a regular visitor but cannot probably input any help, although you never know. Similar TutorialsI've finished the front end design of my application and now intend to provide a version to my potential users to gain feedback.
Does anyone have any experience with the best methods of capturing this feedback? What methods have you used in the past? Questionnaires?
I want feedback on things like the colour scheme, layouts, ease of use etc. From what I've read I can do things like a 1-5 satisfaction scale on multiple questions, but this seems a little vague
guys, I have looked on google for this and apparently noone is doing it. I have 4 checkboxes and I want to send mail indicating which boxes were checked. the only code I've found is PHP that captures the *status* of the boxes, such as "on" or "off". I want to capture the names of the actual checkbox elements. Here is the code I'm currently testing (which just prints out "on" or "off" to indicate which boxes are checked): if(isset($_POST['checkboxes'])) { foreach($_POST['checkboxes'] as $selected){ echo $selected . "</br>"; } } else { echo "No Desired Contact Time Specified."; } if I check all 4 boxes for instance, I get this: on on on on any way to get the names? thanks! I'm trying to get the screen to print out the users IP address so I've used the following code. echo($_SERVER['REMOTE_ADDR']); However this only prints out "::1". Does anyone know why it's printing this and not a proper IP Address? Thanks I currently have a User Authentication Script, which when the user successfully logs in generates a cookie, which is there password encrypted using MD5 which is then verified on every page they visit against there password which works great. I am thinking of adding another level of security, when the user logs in there current ip address is recorded then on every page they visit as well as there password been verified there ip is compared against the ip they had when they logged in. I know that if the user changes there IP they will be logged out, that is fine but is there any other problems which I have not foreseen? is there any reason i should not do this? Thanks for the help The html Form I'm using works successfully with this php code:
<?php //check if form was sent if($_POST){ $to = 's@hmail.com'; $subject = 'Form1'; $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $headers = $name; $message .= "\r\n\r\n" . $name; if( empty($_POST["some_place"]) or $_POST['some_place'] != "glory" ) { header("HTTP/1.0 403 Forbidden"); }else{ mail( $to, $subject, $message, $email, $headers ); } header('Location: https://.......com'); exit; } ?>
The problem is that when the email is received it shows the (from) email address to be my domain account user name @ the server name, like this: Any help or suggested remedy will be appreciated so i've been trying to figure this out for a long time already, but still don't get it how does this "get_ip" thing turns out inside the email in the end? https://stackoverflow.com/questions/51067389/how-to-get-ip-address-from-html-form-using-php
and how can you use the "<?php echo $ip ?>" code inside an html form in the first place if it is only html and not even php at all? (aka the ¤value="<?php echo $ip;?>"¤ part doesnt even work at all and only displays the same exact code instead of the ip...) I have been reading all day on this, and yet I still am not getting it correct. I have read a handful of posts on here and other places and i'm about to pull my hair out, I finally made everything and it's working I just need the IP address to display when they submit their contact information. <p style: align="center"><form action="mail.php" method="POST"> <?php $ipi = getenv("REMOTE_ADDR"); $httprefi = getenv ("HTTP_REFERER"); $httpagenti = getenv ("HTTP_USER_AGENT"); ?> <input type="hidden" name="ip" value="<?php echo $ipi ?>" /> <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" /> <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" /> <div align="center"> <p class="style1">Name</p> <input type="text" name="name"> <p class="style1">Email</p> <input type="text" name="email"> <p class="style1">Phone</p> <input type="text" name="phone"> <p class="style1">Debtor</p> <input type="text" name="debtor"> <br /> <br /> <p class="style1">I hear by agree that the information I have provided is true, accurate and the information I am submitting is <br /> not fraudulent. Please click the agree button that you adhere to Commercial Recovery Authority Inc.'s terms:</p> <select name="agree" size="1"> <option value="Agree">Agree</option> <option value="Disagree">Disagree</option> </select> <br /> <br /> <p class="style1">Employee ID:</p> <input type="text" name="employee"> <br /> <input type="submit" value="Send"><input type="reset" value="Clear"> </div> </form> and then the mail.php form is <?php $ip = $_POST['ip']; $httpref = $_POST['httpref']; $httpagent = $_POST['httpagent']; $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $debtor = $_POST['debtor']; $agree = $_POST['agree']; $employee = $_POST['employee']; $formcontent=" From: $name \n Email: $email \n Phone: $phone \n Debtor: $debtor \n I hear by agree that the information I have provided is true, accurate and the information I am submitting is not fraudulent. Please click the agree button that you adhere to Commercial Recovery Authority Inc.'s terms: $agree \n Employee ID: $employee \n IP: $ip"; $recipient = "mail@crapower.com"; $subject = "Online Authorization Form"; $mailheader = "From: $email \r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); echo "Thank You!" . " -" . "<a href='index.php' style='text-decoration:none;color:#ffcb00;'> Return Home</a>"; $ip = $_POST['visitoraddress'] ?> I need help Hello - I am very new to PHP. I have a simple form that uses gmail SMTP. The form works, but the sender always comes across as the email address from the gmail SMTP account. We need the sender to be the email address filled in on the form.
Here is the form:
Here is the PHP to send the form: <?php
$headers = array(
$smtp = Mail::factory('smtp', array(
if (PEAR::isError($mail)) { ?> How can I get the email to come from the address that's filled in on the form? I would be very grateful for any help...thank you so much!! I'm trying to add an email validation into the code so that it pops up with a similar message as the others if you don't use the @ or .com in your email address and it just ignores it and keeps sending the email anyways no matter what i put into the email field. here is the php i have for it i'm sure it's something really simple but i am not as familiar with php as i would like to be...
When i try and test this to make sure it works it only gives me the message that my email has been sent and i want it to not send if the email address doesn't have the @ sign or the .com or whatever kind of website it's from. I bolded the code that is not working the way i want it too.
<?php
if ($_POST['submit']) { Hi guys, Trying to ge this to work: function checkEmail($useremail) { if (!preg_match("/^( [a-zA-Z0-9] )+( [a-zA-Z0-9\._-] )*@( [a-zA-Z0-9_-] )+( [a-zA-Z0-9\._-] +)+$/" , $useremail)) { return false; $error = '<div id="blackText"><p>Sorry! Please check your email address and try again!<p><p><a href="forumsSignUp.php">Back</a></p></div>'; } return true; //PASSWORD AND OTHER VALIDATION STUFF, blah blah blah } But its just not. Everything works fine if I remove this though. Can anyone suggest an alternative to email address validation? Thanks! I have a form with PHP validation and also a mysqli query checking for duplicates in the database for mailing address and email address in mysql.
It works fine but the customers are adding spaces in the mailing address for example 111 mailing address A V E, 1 1 1 ma iling address A V E etc. and my sql query doesn't see that as an address that's a duplicate.
Their alslo adding email address like my@emailaddress.com and m.y@emailaddress.com, m.y.2@emailaddress.com etc to bypass that comparision also.
Is there anyway to stop this from happening?
Hi
First time post. I have read online and there are so many different answers I do not know which to choose.
I have a form on a website which works fine as it is.
I just want to add a function that when the the visitor clicks submit they get a copy of the email as well.
This is the code I have:
<p>Please read through our terms of business below. If you are happy with them and understand them please complete your details and press the agree button. We will email confirmation of receipt</p> <div class="content_image"> <img src="images/questionnaire.jpg" alt="" width="350" height="225" /> </div> <form id="questionnaire" method="post" action="terms-of-business-send.php" name="questionnaire"> <fieldset> <div> <label>Your Full Name:</label><br /> <input type="text" id="c_name1" name="c_name1" class="qfield clear" /> </div> <div> <label>Your Email:</label><br /> <input type="text" id="email" name="email" class="qfield clear" /> </div> <div> <label>Your Contact Tel:</label><br /> <input type="text" id="tel" name="tel" class="qfield clear" /> </div> </fieldset> <fieldset> <ol> <li> <h2>I agree I have read and understood the terms of business</h2> <input type="radio" name="q1" value="1" /> yes I agree<br /> </li> </ol> <div> </div> </fieldset> <input type="submit" value="Agree"> <input type="reset" value="Reset"> <h4 id="error">There were errors on the form, please make sure your name and email have been filled out correctly.</h4> </form> Then the send file is <?php $c_name1 = $_POST['c_name1']; $email = $_POST['email']; $tel = $_POST['tel']; $q1 = $_POST['q1']; //$to = 'enquiries@email.net'; $to = 'enquiries@cemail.net'; $subject = 'Terms of Business Completed'; $msg = "$c_name1 has completed a Terms of Business from.\n\n" . "Their email is: $email\n" . "Their contact number is: $tel\n" . "-----------------------------\n\n" . "1: $q1\n\n" . "Terms of business copy here" . "-----------------------------\n" . " END OF FORM -------\n" . "-----------------------------\n\n"; mail($to, $subject, $msg, 'From: website Terms of Business Form'); echo '<h2>Thanks for confirming our Terms of Business ' . $c_name1 . '</h2>'; ?> I kind of understand what is going on but am not proficient enough. Any help much appreciated. Rich I want to make the form so only people with a specific email address can sign up to the site. So for example their ending email address was.... @something.apple.biz.com .. but to be accepted into the site, the email HAS to end with apple.biz.com. How could you validate it so it matches something specific like this. Here is my code at the moment which just checks that their is at least one . after the @ for it to be an acceptable email. If anyone could say what else to add to do this would be great if($email != '' && $register){ $emailcheck = explode("@", $email); $sql = "SELECT email FROM member WHERE email='$email'"; $query = mysql_query($sql); $emails = mysql_num_rows($query); if($emails != 0 ){ $alert .= '<p class="alert" style="clear:both;">That email address has already been registered</p>'; $register = false; }elseif(count($emailcheck) != 2){ $alert .= '<p class="alert" style="clear:both;">Please enter a valid email address</p>'; $register = false; }elseif(count($emailcheck) == 2){ $emailchecktwo = explode(".", $emailcheck[1]); if(count($emailchecktwo) < 2){ $alert .= '<p class="alert" style="clear:both;">Please enter a valid email address</p>'; $register = false; } } } Hi I have a simply working SMTP form, however I need this to send to a yahoo.com email address, what can I add to achieve this? SmtpConfig.php ============== <?php //Server Address $SmtpServer="91.186.30.25"; $SmtpPort="25"; //default $SmtpUser="things@wilsoncarandvanrental.co.uk"; $SmtpPass="things123"; ?> SmtpClass.php ============= <?php class SMTPClient { // A function for Setting up SMTP function SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body) { $this->SmtpServer = $SmtpServer; $this->SmtpUser = base64_encode ($SmtpUser); $this->SmtpPass = base64_encode ($SmtpPass); $this->from = $from; $this->to = $to; $this->subject = $subject; $this->body = $body; //Setting Default port Value if ($SmtpPort == "") { $this->PortSMTP = 25; } else { $this->PortSMTP = $SmtpPort; } } //Sending the Mail function SendMail () { if ($SMTPIN = fsockopen ($this->SmtpServer, $this->PortSMTP)) { fputs ($SMTPIN, "EHLO ".$HTTP_HOST."\r\n"); $talk["hello"] = fgets ( $SMTPIN, 1024 ); fputs($SMTPIN, "auth login\r\n"); $talk["res"]=fgets($SMTPIN,1024); fputs($SMTPIN, $this->SmtpUser."\r\n"); $talk["user"]=fgets($SMTPIN,1024); fputs($SMTPIN, $this->SmtpPass."\r\n"); $talk["pass"]=fgets($SMTPIN,256); fputs ($SMTPIN, "MAIL FROM: <".$this->from.">\r\n"); $talk["From"] = fgets ( $SMTPIN, 1024 ); fputs ($SMTPIN, "RCPT TO: <".$this->to.">\r\n"); $talk["To"] = fgets ($SMTPIN, 1024); fputs($SMTPIN, "DATA\r\n"); $talk["data"]=fgets( $SMTPIN,1024 ); fputs($SMTPIN, "To: <".$this->to.">\r\nFrom: <".$this->from.">\r\nSubject:".$this->subject."\r\n\r\n\r\n".$this->body."\r\n.\r\n"); $talk["send"]=fgets($SMTPIN,256); //CLOSE CONNECTION AND EXIT ... fputs ($SMTPIN, "QUIT\r\n"); fclose($SMTPIN); // } return $talk; } } ?> mail.php ======== <?php //Include Class And Config include('SmtpConfig.php'); include('SmtpClass.php'); //Check the Request Method if($_SERVER["REQUEST_METHOD"] == "POST") { $to = $_POST['to']; $from = $_POST['from']; $subject = $_POST['sub']; $body = $_POST['message']; // Send the mail Using the class $SMTPMail = new SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body); $SMTPChat = $SMTPMail->SendMail(); } // After Exit, show the form ?> <form method="post" action=""> To:<input type="text" name="to" /> From :<input type='text' name="from" /> Subject :<input type='text' name="sub" /> Message :<textarea name="message"></textarea> <input type="submit" value=" Send " /> </form> Probably quite straight form, but of course I don#t know how :0) Much appreciated. I have an HTML form that I have a "select" drop-down menu that is selecting the name of the person you should send to. The names are being pulled from the Database, and here is what that code for the drop-down in the form looks like: <?php echo '<select name= "First_Name" , "Last_Name">'; while( $array = mysql_fetch_assoc($result) ) { $text_for_select = $array["First_Name"] . " " . $array["Last_Name"]. " " . $array["District"]; $value_for_select = $array["First_Name"] . " " . $array["Last_Name"] . "_" . $array["id"]; echo "<option></option>\n"; echo "<option value=\"$value_for_select\">$text_for_select</option>\n"; } echo '</select>';?> This works perfectly. However, what I want it to do is send the form to the email address of the person that is selected in the drop-down. The email address' are already entered in each record of the database in a field called "Email". I am using the $value_for_select variable to pull the id of the record, but I am unsure how to then tell the form to send to the email address of that record? Anybody know a way that this can be done? Here is the code of the for that should be sent: <?php if($_POST){ $to = $email; $subject = "WHAT SHOULD THIS BE"; $message = "Date: $date\n\r". "Dear $First_Name, $Last_Name,\n\r". "Blah Blah BLah.Blah Blah BLah.Blah Blah BLah.Blah Blah BLah.Blah Blah BLah.Blah Blah BLah.Blah Blah BLah.Blah Blah BLah.Blah Blah BLah.Blah Blah BLah.Blah Blah BLah.Blah Blah BLah..\n\r". "Sincerely,\n". "$name \n". "$street \n". "$city, $zip \n". "$email \\n". $headers = "From: $email"; mail($to, $subject, $message, $headers); // SUCCESS! echo '<p class="notice">'. 'Thank you for your submission. '. '</p>'; // clear out the variables for good-housekeeping unset($date,$legislator,$bill,$name,$street,$city,$zip,$email); $_POST = array(); } ?> Please help! Greetings Fellow PHPFreaks! LovableCodeMan here - newbie to this forum an pretty new to this PHP thing that all these youngsters are raving about - who knew?! Anyway, so I have an HTML form set up with a PHP document attached in order to send the data from the form to an email -a pretty basic setup by todays standards. In the PHP document, you can see that there is a section for the user (sender@xyz.com) to submit the information in the form to us & is sent to our email address "receiver@xyz.com". The bottom segment is to send a confirmation email back to the sender - to "sender@xyz.com" - as a thank you and a "We will get back to you ASAP" etc etc etc. The confirmation email sent to the sender@xyz.com works flawlessly when pressing the "Send Your Message" button, but then I just see "https://www.xyz.com/scripts/mail.php" in the address bar and no email is received by receiver@xyz.com - aka "Us". This is the PHP document - confidential information redacted & the "sender@xyz.com" & "receiver@xyz.com" replace the real email addresses. <!doctype html> <?php $title = $_POST['title']; $first = $_POST['first']; $surname = $_POST['surname']; $email = $_POST['email']; <!------- sender@xyz.com---> $internationalCode = $_POST['internationalCode']; $number = $_POST['number']; $userMessage = $_POST['userMessage']; $company = $_POST['company']; $Industrytype = $_POST['Industrytype']; $inc_status = $_POST['inc_status']; $state = ['state']; $email_from = "$first $surname <smtp server login>"; $Password = 'smtp server password'; $email_subject = "Website Enquiry from $first $surname"; $messageTo = "receiver@xyz.com"; $email_body = "User title: $title. \n". "The department this message is for is: $department.\n". "User First Name: $first.\n". "User Surname Name: $surname. \n". "User email: $email.\n". "International Dialing Code: $internationalCode. \n". "User Contact Number: $number.\n". "State of Incorporation: $state.\n". "File: $attachment.\n". "Company Name: $company, $inc_status.\n". "Industry type: $Industrytype.\n". "User Message is: $userMessage.\n"; $headers = "From: $email_from" . "\r\n" . "Reply to: $first $surname". "\r\n"; mail($messageTo, $email_subject, $email_body, $headers, "-fweb_support@xyz.com"); header('Location: https://www.xyz.com/thank_you.html'); <!--------Confirmation email send to sender@xyz.com below----------------> $respond_subject = "Thank you for your message"; /* Prepare autoresponder message */ $respond_message = " Hi $first, Thank you for messaging to us. We will aim to reply to you within 24 hours. In the meantime, why not follow our other stories via, as well as following, our Facebook page. Simply go to https://www.facebook.com/xyz/ Yours sincerely, The Support Team receiver@xyz.com. "; $headers = 'From: <Sender> <no-reply@xyz.com>' . "\r\n" . 'Reply-To: $email' . "\r\n" .<!------- sender@xyz.com---> 'X-Mailer: PHP/' . phpversion(); /* Send the message using mail() function */ mail($email, $respond_subject, $respond_message, $headers, "-fno-reply@xyz.com"); //} ?>
This is the HTML document:
<!doctype html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> </head> <body> <form role="form-inline" method="POST" action="../scripts/mail.php"> <div class="form-group"> <div class="row"> <div class="col-lg-2 col-md-4 col-sm-4 col-xs-4 select "> <select class="" id="standard-select" name="title"> <option selected disabled>Title *</option> <option>Dr.</option> <option>Mr.</option> <option>Mrs.</option> <option>Ms.</option> <option>Prof.</option> <option>Rev.</option> <option>Pastor.</option> <option>Miss.</option> </select> </div> <div class="col-lg-4 col-md-4 col-sm-8 col-xs-8"> <input name="first" type="text" placeholder="First Name *" required/> </div> <div class="col-lg-6 col-md-4"> <input name="surname" type="text" placeholder="Surname *" required/> </div> </div> <div class="row"> <div class="col-lg-6 col-md-4 col-sm-6 col-xs-12"> <input name="email" type="email" placeholder="Email *" required/> </div> <label for="standard-select"></label> <div class="col-lg-2 col-md-4 col-sm-6 col-xs-5 select"> <select class="" name="internationalCode" id=""> <option data-countryCode="GB" value="44" Selected>UK (+44)</option> <option data-countryCode="US" value="1" >USA (+1)</option> <optgroup label="Other countries"> <option data-countryCode="DZ" value="213">Algeria (+213)</option> <option data-countryCode="AD" value="376">Andorra (+376)</option> <option data-countryCode="AO" value="244">Angola (+244)</option> <option data-countryCode="AI" value="1264">Anguilla (+1264)</option> <option data-countryCode="AG" value="1268">Antigua & Barbuda (+1268)</option> <option data-countryCode="AR" value="54">Argentina (+54)</option> <option data-countryCode="AM" value="374">Armenia (+374)</option> </optgroup> </select> </div> <div class="col-lg-4 col-md-4 col-sm-12 col-xs-7"> <input type="tel" name="number" placeholder="Telephone Number *" required/> </div> </div> <div class="row"> <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 select"> <select name="inc_status" required> <option selected disabled>Incorporation status *</option> <option>Limited by Guarantee</option> <option>Limited by Shares</option> <option>CIC</option> <option>CIO</option> <option>Unincorporated</option> <option>LLP</option> <option>LLC</option> <option>Other</option> </select> </div> <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 select"> <select name="state" disabled> <option selected disabled>State of incorporation *</option> <option value="AL">Alabama</option> <option value="AK">Alaska</option> <option value="AZ">Arizona</option> <option value="AR">Arkansas</option> <option value="CA">California</option> <option value="CO">Colorado</option> <option value="CT">Connecticut</option> <option value="DE">Delaware</option> <option value="DC">District Of Columbia</option> <option value="FL">Florida</option> </select> </div> </div> <div class="row"> <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6"> <input name="company" type="text" placeholder="Company *" required/> </div> <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 select"> <select class="" name="Industrytype" id="select" value=""> <option selected disabled value="">Industry *</option> <option value="Appraisal/Disposition">Appraisal/Disposition</option> <option value="Business Services">Business Services</option> <option value="Consulting">Consulting</option> <option value="Business Broker">Business Broker</option> <option value="Distribution">Distribution</option> <option value="Education">Education</option> <option value="Financial Services (Non-Lender)">Financial Services (Non-Lender)</option> <option value="Government">Government</option> <option value="Healthcare">Healthcare</option> <option value="Insurance">Insurance</option> <option value="Investment Banking">Investment Banking</option> <option value="Law">Law</option> <option value="Lender">Lender</option> <option value="Logistics">Logistics</option> <option value="Manufacturing">Manufacturing</option> <option value="Media/Print/Broadcast/Internet">Media/Print/Broadcast/Internet</option> <option value="Other">Other</option> <option value="Private Equity/Venture Capital">Private Equity/Venture Capital</option> <option value="Real Estate Services">Real Estate Services</option> <option value="Receivables">Receivables</option> <option value="Retail">Retail</option> <option value="Technology">Technology</option> <option value="Turnaround/Restructuring">Turnaround/Restructuring</option> <option value="Utility">Utility</option> <option value="Wholesale">Wholesale</option> </select> </div> </div> <div class="row"> <div class="col-lg-12"> <textarea name="userMessage" placeholder="Please type your message here. Do not include any personal information such as your NIN or any banking information."></textarea> </div> </div> <div class="row"> <div class="col-lg-6 col-md-12 col-sm-12 col-xs-12"> <div class="" style="background-color: #E0DDDD; padding: 20px;"> <p style="font-size: 12px; color: #0d0155">Information is held under the provision of the General Data Protection Regulation (GDPR). We will not pass your details on to any other organisation. We will process your information in accordance with our privacy policy. By send this message, you agree to xxxxxxx's <a style="color: #0D0155; text-decoration: underline;" href="/privacy/online_privacy_notice.html" target="_new" class="inline_link__new_window">Online Privacy Policy</a> </p> </div> </div> <div class="col-lg-6 col-md-12 col-sm-12 col-xs-12"> <input type="submit" id="submit" name="submit" value="Send your message"/> </div> </div> </div> </form> </body> </html> Anyone know where I'm going wrong, it "half works" so I'm Half Way There - & yes, I am Livin' on a Prayer! Thanks in advance! The LovableCodeman Hello, I know i can use server side code to capture a url etc, however i have a problem, i have a piece of Javascript that collects some information and passes it back to a php page which then proceses the information collected, which all works fine, on that php page i have the code to collect the refferring page, but obviously it just collects the details of the page it has come from which i already know. Is there anyway of using php to look back and get the page before that and any keywords that might have been used to get to that page, i know i could do this with javascript and include that information in the send, however the javascript is on another site and i really would prefer not having to change that if possible. I am not neccesarily looking for the solution but more if it is possible. Any advice would be appreciated. Thanks Hey guys, I m not an expert in PHP but i want to learn php now. So the question is, So i have 2 machines that I want to communicate; let's say 192.168.1.5 and 192.168.1.7 And then, there is a php called test_main.php in 192.168.1.5, then test.php in 192.168.1.7 My goal is to call test.php and then capture the echo result... is it possible? kinda like: in test_main.php Code: [Select] <?php echo file_get_contents("http://192.168.1.7/test.php?test=123123"); ?> in test.php Code: [Select] <?php echo "HELLO WORLD!"; ?> so the output when i call test_main.php is "HELLO WORLD!" Thanks guys! Appreciate it P.S. Maybe the function that I m using is incorrect? Please let me know of another function to use? hello, I was wondering if it is possible to get all the data sent by a html form via post/get method and use it somehow. it is difficult to explain what i mean, i don't mean to say how to get data normally i.e.. by using variables for example $data = $_POST['data']; that can only get only one field that is "data". The reason i am looking for this is because i have many forms that will have to use the mail() function, the problem is creating variables for each from then use the mail() function to send it will be time consuming. and the fields are different in different forms. I have noticed the similar technology used by mailmyform . com, they capture the data in any html form posted to their php page and mail it to the given email. Hello, I am working with a SMTP class to send an email. It's all working perfectly fine, but when the email is received (sent from the online form), and I open my email and click reply, there are two email addresses. The correct one (which I entered when I sent the email), and my ftp username for the site?? I've got three files that could effect this, but I was unable to locate any problems: mailer.php ( smtp send mail class) mail.php ( submission data: title, subject, etc. ) contact_form.php ( form for submission ) I am only including the file which I think is applicable (mail.php), but let me know if you would also like to see the mailer.php class. Current output: reply-to ftpusername@domainname.com, correct_from_email@fromemail.com mail.php: <?php set_time_limit(120); function sendHTMLmail($from, $to, $subject, $message) { $message = wordwrap($message, 70); // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= "From: $from\r\n"; // Mail it mail($to, $subject, $message, $headers); } function sendHTMLmail2($fromid, $to, $subject, $message) { echo $fromid; echo $to; echo $subject; echo $message; include_once("mailer.php"); $mail = new PHPMailer(); $mail->IsMail(); // SMTP servers $mail->Host = "localhost"; $mail->From = $fromid; $mail->FromName = $fromid; $mail->IsHTML(true); $mail->AddAddress($to, $to); $mail->Subject = $subject; $mail->Body = $message; $mail->AltBody = "Please enable HTML to read this"; $mail->Send(); exit; } function isValidEmail($email) { return eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$", $email); } class smtp_mail { var $host; var $port = 25; var $user; var $pass; var $debug = false; var $conn; var $result_str; var $charset = "utf-8"; var $in; var $from_r; //mail format 0=normal 1=html var $mailformat = 0; function smtp_mail($host, $port, $user, $pass, $debug = false) { $this->host = $host; $this->port = $port; $this->user = base64_encode($user); $this->pass = base64_encode($pass); $this->debug = $debug; $this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); if ($this->socket) { $this->result_str = "Create socket:" . socket_strerror(socket_last_error()); $this->debug_show($this->result_str); } else { exit("Initialize Faild,Check your internet seting,please"); } $this->conn = socket_connect($this->socket, $this->host, $this->port); if ($this->conn) { $this->result_str = "Create SOCKET Connect:" . socket_strerror(socket_last_error()); $this->debug_show($this->result_str); } else { exit("Initialize Faild,Check your internet seting,please"); } $this->result_str = "Server answer:<font color=#cc0000>" . socket_read($this->socket, 1024) . "</font>"; $this->debug_show($this->result_str); } function debug_show($str) { if ($this->debug) { echo $str . "<p>\r\n"; } } function send($from, $to, $subject, $body) { if ($from == "" || $to == "") { exit("type mail address please"); } if ($subject == "") $sebject = "none title"; if ($body == "") $body = "none content"; $All = "From:$from;\r\n"; $All .= "To:$to;\r\n"; $All .= "Subject:$subject;\r\n"; if ($this->mailformat == 1) { $All .= "Content-Type:text/html;\r\n"; } else { $All .= "Content-Type:text/plain;\r\n"; } $All .= "Charset:" . $this->charset . ";\r\n\r\n"; $All .= " " . $body; $this->in = "EHLO HELO\r\n"; $this->docommand(); $this->in = "AUTH LOGIN\r\n"; $this->docommand(); $this->in = $this->user . "\r\n"; $this->docommand(); $this->in = $this->pass . "\r\n"; $this->docommand(); if (!eregi("235", $this->result_str)) { $this->result_str = "smtp auth faild"; $this->debug_show($this->result_str); return 0; } $this->in = "MAIL FROM: $from\r\n"; $this->docommand(); $this->in = "RCPT TO: $to\r\n"; $this->docommand(); $this->in = "DATA\r\n"; $this->docommand(); $this->in = $All . "\r\n.\r\n"; $this->docommand(); if (!eregi("250", $this->result_str)) { $this->result_str = "Send mail faild!"; $this->debug_show($this->result_str); return 0; } $this->in = "QUIT\r\n"; $this->docommand(); socket_close($this->socket); return 1; } function docommand() { socket_write($this->socket, $this->in, strlen($this->in)); $this->debug_show("Client command:" . $this->in); $this->result_str = "server answer:<font color=#cc0000>" . socket_read($this->socket, 1024) . "</font>"; $this->debug_show($this->result_str); } } ?> |