Guest recan1230 Posted September 2, 2006 Share Posted September 2, 2006 ;) Hello Fellow Members, I am trying to add a contact form on my contact me page on my website (http://www.designerwebgraphics.com), exactly like the example at this website http://www.osticket.com/contact.php. The form is very simple and I like it for my website. To my understanding their has to be an action code I have to add in order to receive it at my email. Could someone help me? I would greatly appreciate any feedback. Recan1230 Quote Link to comment Share on other sites More sharing options...
roban Posted September 2, 2006 Share Posted September 2, 2006 There was a contact us mod that has since been deleted from the forums. Look at the one on my site and if you want it please PM me with your email address and I'll get it to you. Quote Link to comment Share on other sites More sharing options...
Guest garysmith Posted September 2, 2006 Share Posted September 2, 2006 Your will have to create a html form on your contact us page and then pass the variable to a php script to process, format and sent the message to you as an email. I have written a script for this that you can use as an example. <?php $name = $_REQUEST['name'] ; $company = $_REQUEST['company'] ; $email = $_REQUEST['email'] ; $adcontent = $_REQUEST['message'] ; $message2 = "Message from: $name \n Company: $company \n Email Address: $email \n message: \n $message" ; if (!isset($_REQUEST['email'])) {header( "Location: online.htm" );} elseif (empty($name) ||empty($email) || empty($message)) { ?> <html> <head><title>Error</title></head> <body> <h1>Error</h1> <p> You have not completed all of the required fields. Please press the BACK button on your browser to try again. </p> </body> </html> <?} else { mail( "Youremail.co.uk", "Message from website", $message2, "From: $email" ); header( "Location: thanks.htm" ); } ?> The first 4 lines under the <?PHP collect the data from your form $name = $_REQUEST['name'] ; the 'name' bit is what you would have called the text field for name in your form etc. The second part puts all of the bits of information together as one string (the /n are line breaks) this is basically formatting how your email will look when it is received. the rest of it checks that the field are filled out and if not sends then a message to fill required fields. {header( "Location: online.htm" );} is where you have your form If the script gets to the else statement then the email is sent, header( "Location: thanks.htm" ); is the page you will return them to after the message is sent, normally a thanks for sending the message type page. Save as a PHP file with a title like message.php and in the form you created will be 'Action' that is where you call this script. Sorry for the hasty explianation but the Mrs is waiting to go shopping if you cannot figure it all out you can post or pm me. Gary Quote Link to comment Share on other sites More sharing options...
Guest EverythingWeb Posted September 2, 2006 Share Posted September 2, 2006 I hate to say it, as you have obvoiusly spent a little while putting that together, but it is *highly* insecure. Give me 10mins and a cleverly crafted form request and your server will be acting as a nice open spam realy, capable of sending hundreds & hundreds of emails. Ack! Think you really need to add even some very basic sanitisation of the variables etc. Quote Link to comment Share on other sites More sharing options...
Guest garysmith Posted September 2, 2006 Share Posted September 2, 2006 only meant as an example and as I said I was in a hurry. Your point about security is very valid and I should have mentioned something. Cheers Gary Quote Link to comment Share on other sites More sharing options...
Guest EverythingWeb Posted September 2, 2006 Share Posted September 2, 2006 I didn't mean to come across condescending or arrogant in any way at all. I spend my life keeping servers secure and scripts like the one above are the bain of my life. LOL. I was purely pointing out if someone used it verbatim from here then they are likely to hit problems. I will probably work on a 99.9% secure script for a Contact Form using all the available security methods and release it out for people to use it. Hopefully that will help everyone out :) Quote Link to comment Share on other sites More sharing options...
Guest vrakas Posted September 2, 2006 Share Posted September 2, 2006 All ready have one with secure image validation and testing it I might release it later, we shall see Have posted in the .org forum about it but you can click my banner to see it in action ;) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.