Jump to content

tstout2

Newly Registered
  • Posts

    17
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

tstout2's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hey all! I currently use ASP for most of my pages, but I am working with an application that is in PHP. I need some help protecting my index.php as i have been doing with my ASP files, so can someone help me translate the following ASP code in the PHP equivalent? Thanks so much for any help! Current ASP code: <%@LANGUAGE="VBSCRIPT"%> <% Option Explicit %> <% 'This page will not be cache by the browser (security reason)! Response.CacheControl = "no-cache" Response.AddHeader "Pragma", "no-cache" Response.Expires = -1 'This will make sure no user can access this page without login into the system first, 'If the user type this page address directly into the browser, they will be redirected into the login page! If Session("name") = "" Then Response.Redirect("index.asp") End If %>
  2. FINALLY!!!! I had to do hours of research and piece together lots of code, but I finally have something that works the way I want it to. Thanks to everyone for the help. tstout2 Final Working Code---- <?php /* Subject and Email Variables */ $subject = 'Message from KLS.com'; $to = 'email@kls.com'; /* Gathering Data Variables */ $email = $_POST['email']; $name = $_POST['name']; $phone = $_POST['phone']; $message = $_POST['message']; /* Build Email Body */ $body = <<<EOD Name: $name Email: $email Phone Number: $phone Message: $message EOD; /* Build Email Headers */ $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/plain; charset=iso-8859-1\r\n"; $headers .= "From: $name <$email>\r\n"; $headers .= "Reply-To: " .$email. "\r\n"; /* Send Email */ $success = mail($to, $subject, $body, $headers); ?>
  3. Didn't make a difference for me. If you look back at the code for the two scripts that work, they don't use the syntax your suggesting.
  4. Alright, I haven't been able to get into the flash file yet, but I did take Godaddy's default PHP form mailer script (see code below) and renamed it to mail.php. I then tried the flash form and it worked (see email output below), so the flash form is calling the correct script and it is the original mail.php code. Now, I don't want to use Godaddy's default script because it it does not create an email from the form and then sends it, it merely sends an email (to an email address that must be specified in the hosting server) with the variables and values outputted. I want my form to create a normal looking email that I could respond to (much like what mailtest.php and mailform.php produce. Godaddy's PHP Code---- <?php $request_method = $_SERVER["REQUEST_METHOD"]; if($request_method == "GET") { $query_vars = $_GET; } elseif ($request_method == "POST") { $query_vars = $_POST; } reset($query_vars); $t = date("U"); $file = $_SERVER['DOCUMENT_ROOT'] . "\ssfm\gdform_" . $t; $fp = fopen($file,"w"); while (list ($key, $val) = each ($query_vars)) { fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\r\n"); fputs($fp,"$val\r\n"); fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\r\n"); if ($key == "redirect") { $landing_page = $val; } } fclose($fp); if ($landing_page != "") { header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page"); } else { header("Location: http://".$_SERVER["HTTP_HOST"]."/"); } ?> Godaddy's Output Email----
  5. Godaddy's new Windows 2008 hosting with IIS 7 does include support for PHP5 only. Both of the scripts above that are working on the same account/domain as the one that does not. This means one of two things... the code is incorrect, or the flash file is not directing to that script. I am working on getting the .swf file open to check it out. I am not at my normal PC, so I am trying to get it installed. tstout2
  6. How could that be if those other two scripts work?
  7. Current code.... <?php echo "<pre>"; echo "GET:"; print_r($_GET); echo "POST:"; print_r($_POST); echo "</pre>"; $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $message = $_POST['message']; $headers = "From: ".$name." / ".$email."\r\n"; $ToEmail = "kayla@[..]"; $ToSubject = "Message from [..].com"; $EmailBody = "Name: $name\n Email: $email\n Phone: $phone\n Message: $message\n"; $Message = $EmailBody; mail($ToEmail,$ToSubject,$Message, $headers); ?>
  8. Well, nothing gets echo'ed to the screen. Are you sure this would work with a flash form?
  9. Sounds like a great plan... how do I do this? I am completely new to PHP and don't know how to do what your suggesting.
  10. Please re-read the the post right above yours. These are three separate php scripts that I testing. mailtest.php and mailform.php are two separate mail scripts that I used to make sure my system is performing correctly. Those two scripts work. mail.php is the scripts that came with my flash template website. It gets the values from the flash form to be used in mail.php. mail.php does not work. I want to get it working.
  11. Ok... I am really confused now! If mailtest.php and mailform.php WORK, why doesn't mail.php? Mail.php is supposed to be getting the values from a flash form. mailtest.php ----- <?php $to = "email@domain.com"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "email@domain.com"; $headers = "From: $from"; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> mailform.php ----- <html> <body> <?php if (isset($_REQUEST['email'])) //if "email" is filled out, send email { //send email $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; mail( "email@domain.com", "Subject: $subject", $message, "From: $email" ); echo "Thank you for using our mail form"; } else //if "email" is not filled out, display the form { echo "<form method='post' action='mailform.php'> Email: <input name='email' type='text' /><br /> Subject: <input name='subject' type='text' /><br /> Message:<br /> <textarea name='message' rows='15' cols='40'> </textarea><br /> <input type='submit' /> </form>"; } ?> </body> </html> mail.php ----- <?php $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $message = $_POST['message']; $headers = "From: ".$name." / ".$email."\r\n"; $ToEmail = "kayla@kaylalynnstout.com"; $ToSubject = "Message from KaylaLynnStout.com"; $EmailBody = "Name: $name\n Email: $email\n Phone: $phone\n Message: $message\n"; $Message = $EmailBody; mail($ToEmail,$ToSubject,$Message, $headers); ?>
  12. So change mail($ToEmail,$ToSubject,$Message, $headers); to $success = mail($ToEmail,$ToSubject,$Message, $headers); ? I know nothing of PHP. As for your link, it all has to do with linux. As stated above, I am on Windows 2008, IIS 7, PHP5. I don't have a local php5.ini file, but Godaddy told me that there is one set for the system.
  13. Sadly, it would seem that does not make it work either. Anyone else have any suggestions? tstout2
  14. Hey everyone, I am having problems with my mail.php file. Perhaps someone can correct me? My server is shared hosting on GoDaddy.com with Windows, IIS 7 and PHP 5. Thanks for the help! <?PHP $name=$_POST['name']; $email=$_POST['email']; $phone=$_POST['phone']; $message=$_POST['message']; $ToEmail = "test@kls.com"; $ToSubject = "Message from kls.com"; $EmailBody = "Name: $name\n Email: $email\n Phone: $phone\n Message: $message\n"; $Message = $EmailBody; $headers .= "Content-type: text; charset=iso-8859-1\r\n"; $headers .= "From:".$name." / ".$email."\r\n"; mail($ToEmail,$ToSubject,$Message, $headers); ?>
  15. First off, I changed the true values of "email@domain.com" and "Message from Domain" for this posting. Of course my template already has a form for this, and that is the code I pasted in my original message. The code from the template is from a file called mail.php and the code from godaddy is gd_form.php. So how to I use these together? tstout2
×
×
  • 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.