Jump to content

Spycat

Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Spycat's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok, this is probably laughingly simple to the experts out here. Go ahead and laugh, but can ya help me too...please? Well, from that intro, you have probably gathered that I am [i]not[/i] a PHP programmer. Anyway, here it is: I found a CAPTCHA script that I really liked. However, the author neglected to include code that would take the input entered into the form and e-mail them to me. I went looking around for other form handling scripts that sent the results in order to "piece it together" with the CAPTCHA script. The thing is, most of these scripts get WAY to involved with their own validating processes and such, so I can not get any to work. I have a couple of little "send results to my email" snippets inserted into the code now, but like I said, they are not working. Can someone please take a look at it and well...fix it? I intend to learn PHP, but at this point, I just need the script to work. Also, it is important that the "Thank You Page": "header("Location: http://www.metroactive.com/contact/thanks.html"); " remain functional. I would be really grateful for this. In the code I am providing, I will comment with :"Pieced in" on those parts that are from the 2nd script that sends form responses. All the rest of the code is from the "CAPTCHA" script. Thanks folks :) [code] <?php session_start(); if (isset($_POST['submit'])) { // clean and check form inputs including the secure image code     $name = trim(strip_tags($_POST['name']));     $email = trim(strip_tags($_POST['email']));     $phone = trim(strip_tags($_POST['phone'])); $event_title = trim(strip_tags($_POST['event_title']));     $event_date_and_time = trim(strip_tags($_POST['event_date_and_time']));     $event_location = trim(strip_tags($_POST['event_location'])); $event_phone_number = trim(strip_tags($_POST['event_phone_number']));     $event_price = trim(strip_tags($_POST['event_price']));     $event_description = trim(strip_tags($_POST['event_description']));     $secure = strtoupper(trim(strip_tags($_POST['secure'])));     $match = $_SESSION['captcha']; // the code on the image //Start Pieced in $MailToAddress = "rik408@yahoo.com"; $MailSubject = "Club Event Submission";     if (!$MailFromAddress) {     $MailFromAddress = "$email";     } //end pieced in // input error checking     if ($name=="") {         $err.= "Please provide your name<br/>";     }     if (!$email) {         $err.= "Please provide your email address<br>";     }     if ($email) {         if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {             $err.= $email. " is not a valid email address.<br/>";         }     }     if ($phone=="") {         $err.= "Please provide your phone number<br/>";     } if ($event_title=="") {         $err.= "Please provide the title of the event<br/>";     } if ($event_date_and_time=="") {         $err.= "Please provide the date and time of the event<br/>";     } if ($event_location=="") {         $err.= "Please provide the location of the event<br/>";     } if ($event_phone_number=="") {         $err.= "Please provide a phone number for the venue<br/>";     } if ($event_price=="") {         $err.= "Please provide the price to attend the event<br/>";     } if ($event_description=="") {         $err.= "Please provide a description for the event<br/>";     }     if (!$secure) {         $err.= "No security code entered<br/>";     }     if (($secure!=$match) && ($secure!="")) {         $err.= "Security code mismatch<br/>";     }     if ($err=="") { //start pieced in: this may be a major trouble spot, since it is preceeded by another "if" statement if (!is_array($HTTP_POST_VARS))     return; reset($HTTP_POST_VARS);     while(list($key, $val) = each($HTTP_POST_VARS)) {     $GLOBALS[$key] = $val;     $val=stripslashes($val);     echo  "<b>$key</b> = $val<br>";     $Message .= "$key = $val\n";     }   mail( "$MailToAddress", "$MailSubject", "$Message", "From: $MailFromAddress");   header("Location: http://www.metroactive.com/contact/thanks.html"); //end pieced in     exit();     } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Trolls go away</title> <style type="text/css"> body,td { font-family:arial, helvetica, sans-serif; background:#fff; color:#000; font-size:12px; } input, textarea { background:#eee; color:#000; font-size:12px; border:1px solid #000;  } </style> </head> <body> <?php if ($err!="") {     echo "<strong>Form Error(s)</strong><br/>";     echo "<font color='#cc3300'>". nl2br($err). "</font><br/>"; } ?> <form name="captcha" method="post" action="<?php echo $_SERVER['SCRIPT_NAME'];?>"> <table cellpadding="3" cellspacing="2" style="border:1px dotted #667;"> <tr> <td>Name:</td><td><input type="text" name="name" value="<?php echo $_POST['name'];?>"/></td> </tr> <tr> <td>Email:</td><td><input type="text" name="email" value="<?php echo $_POST['email'];?>"/></td> </tr> <tr> <td>Daytime Phone: </td> <td><input type="text" name="phone" value="<?php echo $_POST['phone'];?>"/></td> </tr> <tr> <td>Club Event Title:</td><td><input type="text" name="event_title" value="<?php echo $_POST['event_title'];?>"/></td> </tr> <tr> <td>Date and Time:</td><td><input type="text" name="event_date_and_time" value="<?php echo $_POST['event_date_and_time'];?>"/></td> </tr> <tr> <td>Location:</td><td><input type="text" name="event_location" value="<?php echo $_POST['event_location'];?>"/></td> </tr> <tr> <td>Venue Phone Number:</td><td><input type="text" name="event_phone_number" value="<?php echo $_POST['event_phone_number'];?>"/></td> </tr> <tr> <td>Price</td><td><input type="text" name="event_price" value="<?php echo $_POST['event_price'];?>"/></td> </tr> <tr> <td valign="top">Event Description:</td><td><textarea rows="5" columns="30" name="event_description"><?php echo $_POST['event_description'];?></textarea></td> </tr> <tr> <td>Security Code</td><td><input type="text" name="secure"/></td> </tr> <tr> <td><img src="captcha_image.php" alt="security image" border="0"/></td><td> <input type="submit" name="submit" value="Send"/></td> </tr> </table> </form> </body> </html> [/code]
  2. Hello, I am a web designer, and to process a form I placed a PHP script in it. The script sends input to an e-mail and writes it to a comma-delimited file as well. Well, I tested it on a Linux server and it works fine. However, when the IT guys placed it on a Windows 2000 server, the form does not process. I got this message from IT: "I tried installing Apache Webserver for windows and it displays the script on the screen when submitted but does not run the form. Rick, Is there anyway you can convert PHP -> ASP?" I was under the impression that PHP was OS-neutral. Further, I do not know ASP and I can't imagine there is a "converter" out there. I also know very very little about Win Servers. As far as permissions, it is 666 in Linux -- does Windows have a similar function (tho I am unsure if that is indeed the problem). Earlier, I sent them these 2 links that I thought might prove to be helpful: [a href=\"http://www.microsoft.com.nsatc.net/technet/archive/interopmigration/linux/mvc/lintowin.mspx?mfr=true\" target=\"_blank\"]http://www.microsoft.com.nsatc.net/technet...n.mspx?mfr=true[/a] [a href=\"http://www.php.net/downloads.php\" target=\"_blank\"]http://www.php.net/downloads.php[/a] But I am not sure if they are. Does anyone know if there are any special things that need to be done/installed in order for Windows Server to run PHP? Because of their length, I didn't want to copy/paste the entire code here, so here is a link to the form: [a href=\"http://www.goodwillsv.org/goodsalesform.html\" target=\"_blank\"]http://www.goodwillsv.org/goodsalesform.html[/a] Here is a link to the PHP script: [a href=\"http://www.goodwillsv.org/goodsales_form-send.php\" target=\"_blank\"]http://www.goodwillsv.org/goodsales_form-send.php[/a] Can anyone help, I sure would appreciate it :)
  3. Thank you much for the help -- it looks good now. I appreciate it! Rick
  4. Hi all, Newbie question here. I have a form that sends out an e-mail with some pre-defined strings in it. However, upon getting the e-mail, I see that some unwanted carriage returns have been inserted. While I realize that this is normal line wrapping, dependent upon the e-mail client being used and the screen resolution, I was wondering if there was a way to force lines to stay together. Here is what I have from my php: [code] ".$name." filled out our Goodwill.of Silicon Valley Customer Information Form\r in order to be notified of upcoming sales in our 16 stores.\r If you would also like to receive these notifications,\r we look forward to you paying a visit to: ".$_POST['refurl'].""; [/code] Everything is sent fine, alsong with the carriage returns I specified by: \r However, when I get the e-mail, a return after "Customer" has been inserted. Is there a solution to this? Thanks, Rick
  5. Why does a posting attempt time out after 30 seconds? Sometimes it takes me 25++ attempts to get the post to go through. Some of us are still on 56k :`( Thanks
×
×
  • 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.